Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Post-Kicker, -Byline & -Footer (http://forum.bytesforall.com/forumdisplay.php?f=17)
-   -   Format a "particular" Post differently (http://forum.bytesforall.com/showthread.php?t=905)

Shepherd Jim Mar 22, 2009 08:34 AM

Format a "particular" Post differently
 
Okay. I now have just the most recent post of a specific category appearing at the top of the center section of my static homepage.

http://www.shepherdjim.com
Please be kind -- the Shepherd Jim w/site is my sandbox where I'm testing stuff.

Now, how do I format the elements of THAT post's <div class="post-bodycopy clearfix">, div class="post-headline">, etc. without changing the appearance of all the other posts on single, multiple, search, etc post pages? I know I should be simply targeting in CSS but I'm not clever enough.

Flynn Mar 23, 2009 02:41 PM

You can change in index.php, towards the bottom:

PHP Code:

<body<?php echo

to

PHP Code:

<body<?php 
if ( is_page() ) { 
    
$current_page_id $wp_query->get_queried_object_id(); 
    echo 
' class="page page-' $current_page_id '"'
?><?php echo

Then add a CSS Insert:

HTML Code:

body.page-XX div.post-bodycopy {
.....
}
body.page-XX div.post-headline {
.....
}

Replace XX with the ID of the page containing the posts to be styled

With the above example you could also group-style all pages due to 2 classes (page and page-XX) being added, i.e. with a CSS Insert

HTML Code:

body.page div.post-headline {
...
}

I am adding CSS classes to "body" in the next Atahualpa version.


All times are GMT -6. The time now is 06:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.