Skip to:
Content
Pages
Categories
Search
Top
Bottom

View Topic By

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

  • Robkk
    Moderator

    @robkk

    you can use the bbPress views widget.

    which would link to optional ways to view the topics.

    Recommended im not sure though?? maybe as an alternative you can use most replied too??

    to add more custom views

    you can plop this code into your child themes functions.php file or add it into a functionality plugin.

    /**
     * Register these bbPress views:
     *  - Popular Topics
     *  - Unpopular Topics
     *  - Random Topic
     *  - Recently Closed
     *  - Tagged Test
     *  - All Topics
     *  - Open (Not Closed)
     *  - Random Single Topic
     *
     * @uses bbp_register_view() To register the view
     */
    function ntwb_register_custom_views() {
    	bbp_register_view( 'popular-topics', __( 'Popular Topics' ), array( 'meta_key' => '_bbp_reply_count', 'orderby' => 'meta_value_num' ), false );
    	bbp_register_view( 'unpopular-topics', __( 'Unpopular Topics' ), array( 'meta_key' => '_bbp_reply_count', 'orderby' => 'meta_value_num', 'order' => 'asc' ), false );
    	bbp_register_view( 'random-topic', __( 'Random Topic' ), array( 'orderby' => 'rand' ), false );
    	bbp_register_view( 'closed', __( 'Recently Closed' ), array( 'post_status' => 'closed' ), false );
    	bbp_register_view( 'taggedtest', __( 'Tagged Test' ), array( 'topic-tag' => 'test' ) );
    	bbp_register_view( 'all-topics', __( 'All Topics' ), array( 'order' => 'DESC' ), false );
    	bbp_register_view( 'open', __( 'Open (Not Closed)' ), array( 'post_status' => 'publish' ), false );
    	bbp_register_view( 'random-single-topic', __( 'Random Single-Topic' ), array( 'orderby' => 'rand', 'posts_per_page' => '1', 'max_num_pages' => '1' ), false );
    
    }
    add_action( 'bbp_register_views', 'ntwb_register_custom_views' );

    sharlene_c
    Participant

    @sharlene_c

    Thank you Robkk .. This is a little intimidating for me as I don’t know php nor do I have experience with child themes but I’ll see if my theme allows for that and try to create one.
    Thank you for giving me the code.


    Robkk
    Moderator

    @robkk

    maybe this guide will help you with understanding.

    Functions files and child themes – explained !

    but you can also put any PHP code snippets in a functionality plugin like this one

    https://wordpress.org/plugins/functionality/


    sharlene_c
    Participant

    @sharlene_c

    ahh thank you. I did actually find that plugin to try and will read the information about child themes thank you.

    S

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar