Image Image Image Image Image

Fish Can’t Whistle Limited

Registered Company Number: 7781289

Studio 30
Fazeley Studios
191 Fazeley Street
Birmingham
West Midlands
B5 5SE

 

Scroll to Top

To Top

Blog

24

Feb
2010

No Comments

In Uncategorized

By Andy

How to show posts per category on a WordPress Powered Site

On 24, Feb 2010 | No Comments | In Uncategorized | By Andy

I responded to a request for help on twitter today from @russellbishop

Here is the request -

Hi there,

Here’s the link to the WordPress site I’m constructing;

Shofu

As you can see on the left hand side, I’ve built a collapsing menu with which to navigate around the site. Unfortunately I’ve had to build that menu manually, as I’m yet to find a function that will give me my categories and their respective posts in a list.

If anyone is able to help I’d really appreciate it.
So, bold hero that I am I tweeted him the answer -

@RussellBishop You need to set up a new query for each <?Query_posts(‘cat=1′); put the loop here only showing titles. Wp_reset_query();?>

Here’s what I meant-

<?php query_posts('posts_per_page=-1&cat=1');?>//this is the line to change per category

 <?php if(have_posts()) : ?>

 <?php while(have_posts()) : the_post(); ?>

 <li><?php the_title(); ?></li>

 <?php endwhile; ?>

 <?php else : ?>

 <?php endif; ?>

<?php wp_reset_query(); ?>

This would show post titles for every post within the category with the id of 1.

TIP: Easy way to find category IDs is to hover over the edit link of that category and look at your browsers status bar. That’ll tell ya!

Maybe that can help some one else along the way.

***UPDATE***

I have since showed Mr Russell how to automatically list the categories and their subsequent posts without having to specify the cat id.

Here it is-


<?php
$cat_args=array(
 'orderby' => 'name',
 'order' => 'ASC'
 );
$categories=get_categories($cat_args);
 foreach($categories as $category) {
 $args=array(
 'orderby' => 'date',
 'category__in' => array($category->term_id)
 );
 $posts=get_posts($args);
 if ($posts) {
 echo '<ul><h1><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></h1>';
 foreach($posts as $post) {
 setup_postdata($post); ?>
 <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
 <?php
 }
 echo '</ul>'; }
 }
?> 

21

Feb
2010

2 Comments

In Uncategorized

By Andy

Making a WordPress data capture plugin – Part 1 – The form

On 21, Feb 2010 | 2 Comments | In Uncategorized | By Andy

As part if a recent project I was tasked with building a data capture wordpress plugin. Of course I could have adapted an already existing plugin for my needs but I fancied the challenge and wanted a bit of ownership over a function I provided. Here’s the breif-

Display multiple forms on a website that not only send notification emails but also store the submitted information in a database that allows the client to download all email addreses as a csv file.

Sounds like a laugh!

I’ll be doing this it 2 sections. Part one (this one) will concentrate on building a simple web form that submits to another page and sends an email. In part 2 we’ll look at building the plugin and saving the form data to that plugin.

So. Here we go.

Here’s the code for the form

<form id="contact" action="<?php bloginfo('template_url'); ?>/thanks.php" method="POST">

 <p>Your Name:</p>

 <input type="text" id="name" name="name">

 <p>Your Email:</p>

 <input type="text" id="email" class="input" name="email">

 <input type="text" id="confirm" class="confirm" name="confirm">

 <p>Your Message:</p>

 <textarea rows="10" id="message" class="textarea" name="message"></textarea>

 <input type="submit" value="Submit">

 </form>

Simple right? Take note of the text field with an id of “confirm”. We’ll be using that in a rather nifty way…

And here’s the css-

.input, .textarea {
 color:#bbbbbb;
 display:block;
 font-size:23px;
 margin-bottom:10px;
 padding-left:10px;
 padding-top:2px;
 width:300px;
}

.textarea {
 width:304px;
}

.submit {
 color:#333333;
 float:right;
 height:30px;
 width:200px;
}

.input, .textarea, .submit {
 -moz-border-radius:8px;
 -webkit-border-radius:8px;
 border-radius:8px;
 border:1px;
 cursor:pointer;
}

.confirm {
 display:none;
}

As you can see, the only special markup here is on the “confirm” class. We’ve set a property of display:none. We’re going to be using this input as our nifty spam catcher. Essentially we are going to check if that field is empty or not. If it’s not empty then it was a bot! Bots will not notice the css applied to the field and just fill it out as normal.

The form submits to a page “thanks.php”. This is where the magic happens!

Here’s the code for thanks.php in full -

<?php include('../../../wp-blog-header.php'); ?>

<?php get_header(); ?>

 <?php    

if (!empty($_POST['confirm'])) {

 echo "ARE YOU HUMAN?";

} else {

 if (isset($_POST['name'])) {

 ?>

 <?php

 $name = $_POST['name'];

 $email = $_POST['email'];

 $messagebody = $_POST['message'];

 $to = "info@jealousdesigns.co.uk";

 $subject = 'New message from ' . $name;

 $message = $messagebody;

 $from = $email;

 $headers = "From: $from";

 mail($to,$subject,$message,$headers);    

 ?>

 <h1>Thanks <?php echo $name ?>!</h1>

 <span>

 <p>You will hear from me soon!</p>

 <p>Andy</p>

 </span>

 <?php

}

}

?>

<?php get_sidebar(); ?>

<?php get_footer(); ?>

There’s a whole bunch of code in their so lets go through it step by step.

First of all we make this page part of the WordPress framework so that we can use all of the handy in built functions-

<?php include('../../../wp-blog-header.php'); ?>

Then we include our header -

<?php get_header(); ?>

Now comes the fun part. First of all we want to check to see if our phoney confirm field has been filled in and if it has stop the process. We then carry on with a little fail-safe and just double check that the field “name” HAS been filled in. (NB. I am using jquery to validate this form in real life but if you wanted to add server side validation here would be the place to do it.)

 <?php    

if (!empty($_POST['confirm'])) {

 echo "ARE YOU HUMAN?";

} else {

 if (isset($_POST['name'])) {

 ?>

Next up we define our variables that have been passed from our form for easy reference later on.

<?php

 $name = $_POST['name'];

 $email = $_POST['email'];

 $messagebody = $_POST['message'];

And now we set up and send our email notification-

$messagebody = $_POST['message'];

 $to = "info@jealousdesigns.co.uk";

 $subject = 'New message from ' . $name;

 $message = $messagebody;

 $from = $email;

 $headers = "From: $from";

 mail($to,$subject,$message,$headers);    

 ?>

And then show a little thank you message-

 <h1>Thanks <?php echo $name ?>!</h1>

 <p>You will hear from me soon!</p>

 <p>Andy</p>

And that’s it! You now have a fully functional online contact form.

Next up we’ll look at building a WordPress plugin to save and display all of this data and how to integrate this form in to it.

16

Feb
2010

No Comments

In Uncategorized

By Andy

26

Jan
2010

No Comments

In Uncategorized

By Andy

19

Jan
2010

No Comments

In Uncategorized

By Andy

16

Jan
2010

No Comments

In Uncategorized

By Andy

Remixes

On 16, Jan 2010 | No Comments | In Uncategorized | By Andy

General, random remixes

Main-stream Artists

Breathe (Lionel Richie)

[audio src="http://fcw.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/hello.mp3"]

 

I Believe in a Thing Called Love (The Darkness)

[audio src="http://fcw.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/I-believe.mp3"]

 

On Top. (The Killers) (Original accapella remix by Selina Blakeney)

[audio src="http://fcw.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/on-top.mp3"]

 

Places to go. (50 cent)

[audio src="http://fcw.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/Places-to-go..mp3"]

 

Sonnet. (The Verve)

[audio src="http://fcw.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/sonnet.mp3"]

 

The Prayer. (Bloc Party) Turn up your bass on this one :-)

[audio src="http://fcw.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/The-prayer.mp3"]

 

Who Got the Funk. (The Streets)

[audio src="http://fcw.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/Who-got-the-funk_.mp3"]

 

Other Artists

Man and Shadow (Benjamin Blower)

[audio src="http://fcw.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/Man-and-shadow.mp3"]

 

Officer. (Leo the Lion from The Streets)

[audio src="http://fcw.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/officer.mp3"]

 

Kersal Massive

[audio src="http://fcw.wpengine.netdna-cdn.com/wp-content/uploads/2011/08/kersal-massive.mp3"]

 

 

 

 

02

Jan
2010

No Comments

In Uncategorized

By Andy

CSS 3 Rounded Corners

On 02, Jan 2010 | No Comments | In Uncategorized | By Andy

For Christmas I received Handcrafted CSS by DAN CEDERHOLM. The book is all about “progressive enrichment”, which is refreshing and interesting. The first chapter deals with “what happens if?” which is all about designing and developing sites that will work no matter what happens. The second chapter deals with rounded corners. This is something that can be interpreted by Mozilla and Webkit browsers.

To use in Mozilla based browsers the following code is used -

 -moz-border-radius: 8px;

And for webkit based browsers (Safari etc) -

-webkit-border-radius: 8px;

Eventually CSS 3 properties will be finalised and all (although you can expect problems with ie) browsers will support it. The sytax will probably be -

border-radius: 8px;

See the proposed recommendations for background and border properties in CSS 3 here.

I have already started using border radius properties for a site I recently developed for a band called Esteban. Check out the Esteban site here. The site is a module based site (various boxes all over the front page with all sorts of social networking and interesting links, items and posts) and it is a nice touch to have the modules rounded where available.

Obviously browsers that don’t yet support border radius will simply ignore the properties and render square border corners. Of course there are numerous ways to implement rounded corners with javascript and cleverly placed images etc but that’s a whole different post.

For now i am happy with using rounded corners where available whilst also including the border-radius property for the future.

What do you think about using CSS 3 before it is properly implemented in all browsers?

19

Oct
2009

No Comments

In Uncategorized

By Andy

Lisacharringtonwilden.com

On 19, Oct 2009 | No Comments | In Uncategorized | By Andy

Lisa Charrington Wilden

Lisa Charrington-Wilden is a super talented artist who works with primarily charcoal, pencil, chalk and conti but is pretty good with most drawing mediums.

She needed a site that accurately reflected herself and her art whilst also being an online canvas for here work. After all the important thing here is her artwork, not ours!

A lovely little site that works well at accentuating beautiful artwork.

Visit lisacharringtonwilden.com by clicking here!

21

Jun
2009

2 Comments

In Uncategorized

By Andy

Every Free WordPress Theme Ever!

On 21, Jun 2009 | 2 Comments | In Uncategorized | By Andy

We think that WordPress, as you may have guessed,  is brilliant. We develop bespoke themes for it but for some people it isn’t practical to pay for a custom design. But don’t fear! There are thousands of free WordPress themes that range from practical to beautiful to absolutely mind blowing!

What i have tried to do here is provide a comprehensive list of where to find every WordPress theme around.

Enjoy and please link in the comments to anything i have missed!

100 Free WordPress themes from Smashing Magazine.

83 Free WordPress themes you probably haven’t seen from Smashing Magazine.

Comprehensive list of 980+ Free WordPress 1.5 and 2.0 Themes / Templates available for download

The Best Minimalist Wordpress Themes

50 Beautiful Free WordPress Themes

14 Most Visually Appealing Free WordPress Themes | Web Design Ledger

Best Free Magazine WordPress Themes

45 Best Free WordPress Themes of All Time | WordPress Blogging …

45+ Must See WordPress themes | Noupe

41 Great Looking Free WordPress ThemesWordPress

45 Excellent Free WordPress Themes | Dzine Blog

55 Free and beautiful WordPress themes | OpenSourceHunter

13 Premium-Like WordPress Themes That Are Free And Stunning …

40 Excellent Free WordPress Themes

18 Adsense Optimized WordPress Themes to Maximize your Contextual …

40 Stylish, Minimal and Clean Free WordPress Themes : Speckyboy …

20 Free Corporate WordPress Themes | Blogging Tips from Blogsessive

140+ Brilliant Free WordPress Themes Around | Showcases | instantShift

13 Awesome Collections Of Free WordPress Themes

10+ Free Magazine Style WordPress Themes to Choose From

Top 50 free WordPress themes | CrazyLeaf Design Blog

10 Remarkable (and FreeWordPress Themes

20 Great Free WordPress 2.7 Themes

50+ Free WordPress Themes for Personal Blogs of High Quality – WPZOOM

100 Superb WordPress Themes For Free! | Best Design & Development …

Best WordPress Themes » 10 Free WordPress Themes That Blow Many …

18 Free WordPress Themes

1000+ Free WordPress Themes | Fresh WordPress Templates

100 Beautiful Free WordPress Themes | Back to Essentials

85 best beautiful free WordPress Themes | [Re]Encoded.com

413 Best Free WordPress Themes | Best WordPress Themes for Free

24 High Quality Free WordPress Themes | Toxel.com

The 25 best free wordpress themes available – FrancescoMugnai.com

Free WordPress Templates Galore

100 The Very Best of Free WordPress Themes « WPCrowd

Kallista 1.0 – A Quality Minimal Free WordPress Theme | The Theme Blog

61+ Free Business WordPress themes – Ntt.cc

16 Free Premium WordPress Themes That Don’t Suck | WordPress

Top 5 free WordPress themes for October : Free web templates …

15 High Quality Premium-Like Free WordPress Themes | Noupe

20 Most Beautiful Free WordPress Themes | 10Steps.SG – Photoshop …

13 Awesome Collections Of Free WordPress Themes | Smashing Downloads

15 Interesting Christmas Free WordPress Themes | DeveloperFox

22 Apple Inspired Free WordPress Themes

40+ Free WordPress Theme: High Quality collection – Espreson

22 Professional WordPress Themes And Resources:Less Is More …

10 Best Free WordPress Themes You Haven’t Seen :: Elite By Design

DazzlinDonna » Very Best Free (GPL) WordPress Themes to Modify and …

50+ New and Beautiful Free WordPress Themes | CrazyLeaf Design Blog

10 New Free WordPress Themes | Microgeist

10 Places for Free WordPress Themes

Top 30 Free WordPress Themes |

55 Free and Beautiful WordPress Themes – Creattica Daily

20 Free WordPress Themes That Will Rock Your Socks!! | Beyond Random

26 Free WordPress Photo Gallery Themes | [Re]Encoded.com

The Top 5 Free SEO Friendly WordPress Themes

43 Phenomenal and Advanced Groundbreaking WordPress ThemesFree

GissiSim.com | 6 Free WordPress Themes Youd Pay For

googit: 100 The Very Best of Free WordPress Themes

100 Best WordPress Themes You Are Going to Use (and Love) in 2009 …

15 Excellent Free WordPress Themes | Web and designers | Helping …

25 Beautiful Free WordPress Themes That Offer Theme Options …

Inspiration: 22 beautiful (and free!) WordPress themes « WP TOY

4 Hi-Quality Free WordPress Themes | The Hosting Nerds’ Speakeasy

TechTreak.com » Downloads » 33 Most Popular Sites For Free

20 Free WordPress Magazine Style Themes | Social CMS Buzz

35 Free Premium WordPress Themes You Probably Missed | Listropolis

27 Stunning Yet Free Premium WordPress Magazine & News Themes

37 WordPress Theme Databases and Blogs | Mitchelaneous

My 23 Favorite Free WordPress Themes » Ask Shane.org

25 Best Free WordPress Themes | EliteFreelancing.com