Skip to:
Content
Pages
Categories
Search
Top
Bottom

new css classes to post


  • crazy-nomce
    Participant

    @crazy-nomce

    How I can add new css classes to a (specific) post? It already exists or I should make a request for a new hook (if possible)?

Viewing 4 replies - 1 through 4 (of 4 total)

  • crazy-nomce
    Participant

    @crazy-nomce

    Bump! Anyone knows?

    Thanks in advance.

    You can use the following three filters:

    bbp_get_forum_class
    bbp_get_topic_class
    bbp_get_reply_class

    Each of them function exactly like the core WordPress post_class filter: http://codex.wordpress.org/Function_Reference/post_class


    Daniel J. Lewis
    Participant

    @djosephdesign

    How do we implement this? I tried replacing

    <ul id="bbp-topic-<?php bbp_topic_id(); ?>" <?php bbp_topic_class(); ?>>

    with

    <ul id="bbp-topic-<?php bbp_topic_id(); ?>" <?php echo bbp_get_topic_class('test-class'); ?>>

    but the test class doesn’t show. I know I’m working with the right line of code because I can remove the class part altogether and see it removed from my site.


    Daniel J. Lewis
    Participant

    @djosephdesign

    I figured this out. I had to add this in my bbpress_functions:

    function my_topic_class($classes) {
    	$classes[] = 'test-class';
    	return $classes;
    }
    add_filter( 'bbp_get_topic_class','my_topic_class' );
Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.