WordPress

ReDev…again

By 11 May ’09 3 Comments

I’m trying desperately to do some hardcore WordPress theme development and i fear i am a wee bit over my head. However, usually when i do something stupid and try and make the site do something it doesn’t normally, well, i’m always in way over my head but there you go. I am posting this here and on wordpress.org to see if anyone can help me with it.

Old Current Version

Old Current Version

The first image here is how the site currently works/looks. First it takes the most recent post and features it at the top of the page. Then it goes on to display the next ten or so posts with thumbnails albeit limited to 220 characters or so. It is checking the category then assigning the appropriate image. It does that using the following code:

<?php if (is_category(‘7’) ):
<img src='<?php bloginfo(‘template_url’);?>/images/cat7.jpg’ alt=” />
<?php } elseif (is_category(‘8’) ):
<img src='<?php bloginfo(‘template_url’);?>/images/cat8.jpg’ alt=” />
<?php endif; ?>

This is an abbreviation of the full code used as i’m using about 10 diff categories and thumbnails.

This is all a bit messy to be honest. And now i am using twitter it is becoming crowded with that little bird bless him. I want to restyle the layout of the posts. That can be done simply with some good CSS. What I really want to do though is to change the layout of the tweet posts completely.

 

New Layout

New Layout


This is where the second image comes into play. This image shows roughly how i’d like to display the Tweet posts and the standard posts. I’m gonna do away with featuring the first post as its not really for me on this site – i hate it actually. You will see though that the layout of the tweetpost is very different from the standard one.

I’m using twitter tools to sort the tweets and part of what it does is post my tweets as posts but in doing so it creates a title as well as the content. Fair enough

– it has to for wordpress. I don’t want it to display the Title ad the content. I want to get rid of the titles for these tweetpots.

The way i have been thinking of doing it:

I want to create different templates for each category then create a query in the loop to see which template to use to display the post. The lovely people at wpcandy.com have created a great cheat sheet on a PDF (found this via webdesignledger.com), on the 3rd page is the following code:

<?php
$post = $wp_query- >post;
if ( in_category(‘3’) ) {
include(TEMPLATEPATH . ‘/cat3.php’);
} elseif ( in_category(‘4’) ) {
include(TEMPLATEPATH . ‘/cat4.php’);
} else {
include(TEMPLATEPATH . ‘/cat.php’);
} ? >

I want to put this code in to my pages so that whenever a tweet or standard post appears that it will display in a nice and pretty fashion. I just don’t have the PHP/WordPress skills to know which bits of code to change. I have been trying but i keep getting errors.

SOOOOOOOOOO…..

any ideas?

If anyone out thewre with a super-brain cares to crack this one i’d be a very happy boy.

Questions welcome.

You can find this as a forum post on the wordpress forums too here.

Join the discussion 3 Comments

  • […] wordpress Developers out ther care to help on this: http://www.irishmark.net/?p=1751 2 mins […]

  • Sid O'Neill says:

    Hi Mark.

    Why not just make it decide right there in your theme's index.php? All you'd need to do is something along the lines of

    if category is tweet {

    div class=tweet

    code for displaying the post here

    /div }

    else {

    div class=all_other_posts

    code for displaying the post here

    /div }

    Then you'd need to find the bit in your theme which is "div class=post" and stick that whole div in the tweet div or the all_other_posts div, obviously not echoing the title for the posts in the tweet div. Then you can CSS the rest of the way, now that tweets and posts are contained within different divs.

    Great site by the way – I feel your re-design pain. I feel like I re-design my site(s) about once a week. It's never quite good enough, is it?!

    Apart from that, I'm jealous that my girlfriend spent more time on your blog than she's ever spent on mine! 😀

    • mark says:

      Thanks for the input dude – i realise aswell hat i just completely suck at css anyway so its getting a balance of hope and blind faith

Leave a Reply