Skip to:
Content
Pages
Categories
Search
Top
Bottom

Mark a Recent Topic as "Read"


  • Clicknathan
    Participant

    @clicknathan

    Does anyone know of a way I could add a CSS class to items that a user has already viewed.

    I have some custom code (taken from the bbpress Recent Replies widget) that essentially shows my recent replies on my forum’s home page. This:

             $post_types,
                'post_status'    => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ),
                'posts_per_page' => $max_shown,
                'meta_query'     => array( bbp_exclude_forum_ids( 'meta_query' ) )
            ) );
    
            // Get replies and display them
            if ( $widget_query->have_posts() ) :
    
                echo $before_widget;
                echo $before_title . $title . $after_title; ?>
    
    
    
                    have_posts() ) : $widget_query->the_post(); ?>
    
                        <li >
                        post->ID );
                              $author_link = bbp_get_reply_author_link( array( 'post_id' => $reply_id, 'type' => 'both', 'size' => 100 ) );
                              echo $author_link. ' on';
                              echo '<a href="' . esc_url( bbp_get_reply_url( $reply_id ) ) . '" title="' . bbp_get_reply_excerpt( $reply_id, 50 ) . '">' . bbp_get_reply_topic_title( $reply_id ) . '</a>';
                              echo ''. bbp_get_reply_excerpt( $reply_id, 150 ) . '';
                              echo '' . get_the_date(), get_the_time().'';
    
                            ?&gt;
    
    
    
    
    
    
    
                &lt;?php echo $after_widget;
    
            endif;
    

    is_mb there is just a custom function I wrote to determine whether the page being viewed is the homepage or not. Anyway, I'd love to add a class to the opening LI tag if a user has already viewed that. Any ideas?

  • You must be logged in to reply to this topic.
Skip to toolbar