Articles of post class

Adding class to featured image

I have specified a loop to show featured images for my custom post type and wish to add a img-responsive class from bootstrap to my featured image. How can I do this? Thanks! Code: <div class=”home-featured-img”> <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. the_post_thumbnail(); […]

How to style posts selecting a CSS post_class (added through custom_fields?)?

Here is what I tried and couldn’t reach it. Maybe I need a whole different approach? 1) I created a custom field in a post, called post-class and inserted the value cita-flow800000 (weird class name means: citations flow structure using the #800000 as the main color, for those who might be curious) 2) I called […]

WordPress call post-ID in jquery

I explain the situation I’m having here: On my home page, I have a list of post being display. I’ve code to have like a modal box to share this post. Basically, on each post you have a button share. On click, a box display with the sharing link to FB, twitter,etc. Exactly like this: […]

Where should I use post_class()?

I am trying to learn WP Theme development. And as I have understod it is important to use “post_class()” since plugins may need to use it. But what I not understand is where I should use it? Should I use it for the post for the main loop. Or should I use it for my […]

How can I add a class to particular paragraphs in my post?

The effect I’m looking for in the end is to have the first line in some paragraphs bolded. These would be the first paragraph of each section in my post. This kind of effect is used on this Bloomberg.com post. Notice the first paragraph in the post and then also the first paragraph of later […]

How to edit the styles for the table of pages/post listed in the admin when you click on pages/posts?

It seems that some of the css on the table that shows the list of all the pages adversely reacts with one of my plugins, which adds a bunch of columns to the table. I’m pretty sure this is edit.php. At least, that’s what’s in the URL. Using the developer tools in Chrome I noticed […]

How to add post classes?

I can use post_class() to echo all classes for a post. How can I output only the category-ID as a class, and how can I include this while using heredoc string syntax? I got this function in which I would like to use post_class(), and I have tried get_post_class() which does not work, because its […]

How to add padding between posts

Ultimately, I’m really confused on how exactly you create a single class that affects each post in a static home page “recent post” type content area. I want to essentially have it where there’s a post with a background, a space, then the next post with the same background, but not have the background behind […]

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 page with certain conditions (eg. logged-in), the function produces this: <body class=”search search-results logged-in admin-bar single-author two-column right-sidebar”> I need the full […]

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 the “id=”post-<?php the_ID(); ?>” <?php post_class(); ?>” part of it instead of echoing it. $sidebar […]