Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to use BBpress functions in WordPress?


  • frenzis73
    Participant

    @dadahtml

    I would like to show the latest forum in the footer of my WordPress site. I would like to use bbp_list_forums(); function. But it seems is not possibile.

    Could you help?

    Regards, Francesco.

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

  • frenzis73
    Participant

    @dadahtml

    UP ๐Ÿ™‚

    Use the [bbp-forum-index] shortcode https://codex.bbpress.org/shortcodes/


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    • Use a regular old WP_Query()
    • Use a widget
    • Use bbp_has_forums()
    • Use the shortcode mentioned above

    There are lots of examples, in the forums, on the codex, and in the bbPress code itself. Also, unclear what you mean by โ€œlatest forum.โ€ Do you mean topics, or replies, or something else?


    frenzis73
    Participant

    @dadahtml

    Widget and shortcode are not so “themable” like I would. WP_QUERY is right, but then I cannot use bbp_* in my file.

    What I want is use every BBP Functions inside my, eg, single.php: show author, show forums, show topic simple calling bbp_**

    How bbp_has_forums() works? It loads the functions ouside the BBP pages?

    Regards, Francesco.


    frenzis73
    Participant

    @dadahtml

    Up bis ๐Ÿ™‚

    bbp_list_forums needs to be run inside a bbpress loop. Which you call with bbp_has_forums(), which creates a forum object. For example.


    bbp_set_query_name('load_stuff');

    if ( bbp_has_forums(array(
    'post_parent' => 0,
    'post_type' => bbp_get_forum_post_type(),
    'posts_per_page' => get_option( '_bbp_forums_per_page', 50 ),
    'orderby' => 'menu_order',
    'order' => 'ASC'
    )) ) : ;

    bbp_get_template_part( 'loop', 'forums' );

    else : ;

    bbp_get_template_part( 'feedback', 'no-forums' );

    endif;

    bbp_reset_query_name();


    frenzis73
    Participant

    @dadahtml

    Thanks plauclair

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