The post-class tag has no wiki summary.
0
votes
2answers
53 views
Using post_class to style posts indivdually
I have a homepage on which I want to display the latest post different from the other posts. I haven't used post_class and I am not sure how to.
Would I be able to achieve what I want using ...
0
votes
2answers
28 views
How do I add a custom body class for a specific page ID?
I have added this code to my child theme's functions.php file and use the new class but it styles the entire site, not the page I added to the code. What am I doing wrong?
...
1
vote
1answer
38 views
Add a class to post title if a link ends with a certain extension
I am using a Page Links To plugin that allows me to link the post title to an external web page, rather than to the content of the post. And I link some of the post titles to external pages, and ...
0
votes
1answer
39 views
How to get category names in post_class?
I have this class for my posts:
<?php post_class( 'entry-image' ); ?>
I want to add the category names to get isotope work, i followed this guide ...
0
votes
2answers
75 views
Odd/even class on article tag
I am using the article tag with the following code:
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix span4 '); ?> role="article">
</article>
and I would like ...
0
votes
1answer
38 views
How to use post_class function?
I would like to use this function, but I don't know correctly what is the perfect way..
The code:
<li id="post-<?php the_ID(); ?>" <?php post_class(get_the_content() == "" ? ...
0
votes
1answer
49 views
Child Pages Loop
If anyone can help that'd be great.
I've found a snippet of code that I've used which is pretty much doing what I want it to do, which lists out subpages of the parent, adds a thumbnail if there is ...
1
vote
1answer
30 views
Theme Check: Could not find post_class
I've inherited a theme from a another developer that I've re-styled for a client. We're just about finished, but I thought I'd run it through the Theme-Check plug-in to see if there's any errors or ...
0
votes
1answer
36 views
Add a class to post_class if more than one post shares same meta_value_num
I would like to be able to add a class such as .samedate to posts that share the same meta_value_num from a custom meta box.
So for example:
Say two posts share the same custom meta box value for a ...
0
votes
1answer
81 views
If Loop has odd number of posts on last page Custom style for last post in it
My loop displays posts in two columns using this php
<?php
if (have_posts()): while (have_posts()) : the_post();
$count++;
?>
<?php if ($count == 1) : ?>
<div ...
0
votes
3answers
50 views
Need help “sanitizing” a custom function that pulls category slug into body class
Not sure if "sanitizing" is really the correct phrase to use for this but it was the best one I could think of...anyways, here is the problem:
My function works great like so...
// add category id ...
0
votes
1answer
83 views
post_class remove tag- or category- from slug
I've got this in my theme
<article <?php post_class('archiveMain'); ?>>
But for tags and categories it adds tag- or category- before the slug, any way to remove that?
Example: ...
0
votes
1answer
42 views
Enclose title within a div?
I'm using this code to display a page within my front page. I would like to learn how to add a div / spacer to isolate the page title... If I try to add a div class within the php code then it throws ...
0
votes
1answer
89 views
Add $values to post_class()
This must be pretty simple, but it is eluding me. I need to add several classes to post_class() http://codex.wordpress.org/Function_Reference/post_class
I can add one class in a page template, as ...
0
votes
1answer
472 views
How can I make wp_list_categories output li with category-slug as class, for its children?
Simply put, I'd like to change the wp_list_categories output from this:
<li class="cat-item cat-item-1"><a href="http://mysite.com/category/articles">Articles</a></li>
...
2
votes
2answers
220 views
Wordpress Loop - Style rows of posts differently
I am trying to adapt the Wordpress loop to style posts differently in rows that get
infinitely smaller until all posts are displayed
The concept here is to display posts in rows
first row 1 post
...
0
votes
2answers
223 views
adding a custom css class to post
essentially I need to be able to add a class to a post when it show in the list (say index.php) so when in the back end you can say oneCol, twoCol, threeCol and it will then output this within the ...
0
votes
1answer
75 views
post_class output in wrong area?
Trying this in my functions file. There is actually a lot more to this function than I am showing, but this is the important part that is messed up.
function xyz_loop() {
$defaults = array (
...
0
votes
1answer
77 views
How can i remove the posts category class names from body_class
I have 2 categories, just to make an easy example, Cars and Bikes.
I have a post that fits both of the category.
If i visit the Cars category, the body_class looks like this:
"archive category ...
0
votes
1answer
119 views
post_class() breaks out of formatting. . . extra markup also generated
Hoping Im just running into something easy
Here's the scenario, I've created a function called tr_get_post_image_tplt that spits out the post thumbnail (or custom size) for the post being called.
Im ...
0
votes
1answer
713 views
add filter to wp_list_categories and query if used to list tax-terms?
this is probably a confusing title of my question, but it's exactly what's describing my problem best.
I want to add the category-slug as classname to my wp_list_categories() output.
I found a really ...
0
votes
1answer
505 views
CSS class on last post in loop ( custom query )
I have been using this question to try to do this but I am having some difficutlty. I have a custom post type, media, and I am working on the archive-media.php template.
I have it partially working ...
10
votes
4answers
420 views
How to mark every 3rd post
I'm working on a WordPress site for my band and I'd like to mark every 3rd post on our blog page to have a special class applied to it, anybody have any pointers on how to achieve this? Any help is ...
1
vote
1answer
179 views
Add Post Tags to Body Class
Want to add post tag name to body class - I am successful in using the code below to add category to body class -
//adds new body class for post category
add_filter('body_class', ...
1
vote
1answer
78 views
How to make classes for posts?
Thanks in advance.
I'd like to have posts with different colored borders and headers. It would be nice to choose a category of the post (red, blue, black, etc.) and have it change the class for that ...
0
votes
1answer
342 views
Adding post_class into functions.php query
Obvious newbie question I'm sure. Working on a friend's site and trying to figure out how to add post_class to a query. Just adding works fine and adds the div, but I don't know how to get it to run ...
2
votes
2answers
778 views
Get parent category class in post_class()
I am trying to add the parent category class in post_class() of some posts from one of my subcatgories. I have an advanved theme so I need to style all the posts from the parent cateogry using it's ...
0
votes
2answers
504 views
List of Body Classes Generated by body_class()
Does anyone know where I can get a list of all the body classes generated by body_class() for every sections and every conditions, including custom post-types, etc.?
For example, for a search result ...
1
vote
1answer
517 views
Duplicate attribute class causing site validation error
The following bit of code results in a duplicate attribute site validation error.
This template script:
<div class="clearfix" <?php post_class() ?>>
produces this source output:
...
1
vote
2answers
1k views
Add post classes for custom taxonomies to custom post type?
I was surprised to learn that custom taxonomies aren't added as body or post classes like categories and tags are.
I'm sure this will be added in a future version of WordPress, but in the meantime I ...
2
votes
2answers
1k views
Alternate post_class on each post
I need to have an alternating (even, odd...) class on posts to provide alternate highlights on a column. The best thing would be to attach this to the post_class() so that it's on every instance of ...
