Questions tagged [post-class]

The tag has no usage guidance.

12 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
107 views

How to load post_class() locally

I'm using post_class() function to retrieve WordPress provided classes for a post. I've successfully implemented an AJAX powered "Favorite Post" functionality to each and every post, and I'm changing ...
1
vote
1answer
75 views

How to assign classes to all elements?

Is it possible to assign classes to elements of certain type? For example, all paragraphs in the post body or comment body should have class="paragraph", all unordered lists in post body should have ...
0
votes
0answers
63 views

How do I use $wp_query->current_post with get_template_part? I'm trying to add post classes (first/last/even/odd) to custom loops

... but $wp_query->current_post and the like don't work when I use get_template_part to pull in content.php files as modeled by themes like twentynineteen. The variables don't carry over I guess? Is ...
0
votes
0answers
432 views

Is it possible to store Custom Post Type data in separate set of tables and still have wp_post class functionality?

I have a couple of custom post types (course and assignment) for an custom LMS plugin that I'm building. The course CPT represents content that is produced internally by the company. The assignment ...
0
votes
1answer
159 views

get_post_class not working properly

I have a plugin on my WordPress site that lists the most visited pages. I recently realized that it was displaying certain pages that I don't want to display. I also want to be able to disable pages ...
0
votes
1answer
43 views

Highlight a Post on archive page if it has a new comment?

I have been searching for a solution to highlight a post if it has a new comment but there is no plugin/forum answer about this. Basically I have a custom post type listings on a page. I want to add ...
0
votes
1answer
52 views

Method 'post_title' not found in class.

I'm running some code through phpStorm and am getting an error: Method 'post_title' not found in class. at this line: echo $post->post_title(); Is that phpStorm getting things wrong or am I ...
0
votes
1answer
638 views

Post Class for Custom Taxonomy Error

I'm getting two errors with the following code. I'm essentially trying to go through all the custom taxonomies and add them to the post class. Notice: Array to string conversion in /...
0
votes
1answer
110 views

Different styles for categories - need to edit a plugin

I'm using a plugin to add recent posts to home page and I am using different styles for the categories. I have the different styles working on the blog page but not on the posts output from the ...
0
votes
1answer
133 views

Help with output of post classes using apply_filters

I’m new to scripting, this is a plugin I'd like to modify to output post classes. When I try using: apply_filters( 'post_class', $page->post_class ) it only outputs array=" ". Do I need an ...
0
votes
0answers
190 views

How to remove a class from a post_image div?

So for a post i know how to remove a class by using function remove_class( $classes ) { $classes = array_diff($classes, array('hentry')); return $classes; } add_filter('...
0
votes
1answer
84 views

How do I create a sticky sidebar?

How do I give the three posts here different div classes? I'm working with twitter bootstrap and I'm trying to give the first post and the last one <?php query_posts('category_name=Menucard'); ?&...