Skip to:
Content
Pages
Categories
Search
Top
Bottom

is_singular() Always False, Everywhere


  • Andrew Tibbetts
    Participant

    @andrewgtibbetts

    I am trying to figure out why bbPress (inside Buddypress) isn’t enqueueing topic.js on topic pages so that favoriting and subscribing buttons ajax instead of refresh (which they currently do).

    In enqueue_scripts(), bbp_is_single_topic() is being checked before allowing the js files to be enqueued.

    In the bbp_is_single_topic() function declaration, is_singular( bbp_get_topic_post_type() ) || bbp_is_query_name( 'bbp_single_topic' ) must be satisfied to return true.

    Issue: is_singular( bbp_get_topic_post_type() ) returns false (also is_singluar('topic') and just is_singluar() — also, no matter where I go in bbpress, is_singluar() returns false).
    Tangential: echoing bbp_get_query_name() returns nothing.

    Any ideas?

    NB: This was tested on fresh Twenty Twelve with all non-essential plugins disabled and bp-custom.php emptied.

    WP: 4.4.1
    BP: 2.4.3
    BBP: 2.5.8

Viewing 5 replies - 1 through 5 (of 5 total)
  • @andrewgtibbetts can you install the following two plugins and take another look?

    https://wordpress.org/plugins/query-monitor/
    https://wordpress.org/plugins/query-monitor-bbpress-buddypress-conditionals/

    Here’s what I see, is_single(), is_singular() and bbp_is_single_topic() all return true

    BbPress Topic JS


    Andrew Tibbetts
    Participant

    @andrewgtibbetts

    Thanks, Stephen.
    Ok, so, Query Monitor is telling me that topic pages are returning true on a bunch of is_s:

    is_page()
    is_singular()
    is_bbpress()
    bbp_is_single_topic()
    is_buddypress()
    bp_is_group()
    bp_is_group_forum_topic()
    bp_is_group_single()
    bp_is_groups_component()
    bp_is_single_item()

    But, when i put echo is_singular( bbp_get_forum_post_type() ) ? 'yes' : 'no'; exit; on line 255 of bbpress/includes/common/template.php inside bbp_is_single_topic(), I get a white page that says “no”.

    Your checking for is_singular() on the forum post type rather than the topic post type above in your code above.


    Andrew Tibbetts
    Participant

    @andrewgtibbetts

    Ooops.
    I have been jumping back and forth testing forum home and topics as they both don’t work and I copied the wrong line I was using.
    So, correction:

    …when i put echo is_singular( bbp_get_topic_post_type() ) ? 'yes' : 'no'; exit; on line 255 of bbpress/includes/common/template.php inside bbp_is_single_topic(), I get a white page that says “no”.

    I get the same “no” doing the forum check in the forum function while on the forum page.

    Using your code I get a blank white page with yes

    Also to note, the screenshot I posted above of Chrome inspector includes at the bottom that topic.js?ver=2.5.8-5815 has correctly loaded.

    Are you sure you haven’t got any other plugins or code stashed in a functions.php or hacks elsewhere that may be causing your issues?

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