Skip to:
Content
Pages
Categories
Search
Top
Bottom

Sticky posts aren't being assigned Sticky class

  • I installed bbpress on this morning. I have been slowly integrating it into my worpdress twentyeleven child theme. One thing I am noticing is that the sample sticky posts I created are not receiving the sticky class added to them.

    What I’ve done so far is copy over archive-forum, page-topic-tags, sidebar-bb-tagcloud, single-forum, single-topic, single-user and taxonomy-topic-tag into my child theme and formatted the each page to match my existing theme. If i view my site in live preview using the bbpress theme I see that the Sticky class is being applied to the sticky topics. I’m not sure why this isn’t happening using my child theme?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I just noticed that all kinds of classes aren’t being applied to the individual topic rows? Looking at the same page using live preview I see the following classes were applied: post-2019 topic type-topic status-publish hentry odd super-sticky bbp-parent-forum-1998 user-id-1.

    Whereas in my child theme I have exactly no classes applied.

    I found the problem. I had a function in my functions.php was malformed. The correct way was this way:

    // Add classes to posts
    add_filter('post_class', 'my_post_classes');
    function my_post_classes( $classes )
    {
        $postType = get_post_type();
    
        if ( $postType == 'post' ) {
            $classes[] = 'clearfix';
    
        }
    
        return $classes;
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar