Skip to:
Content
Pages
Categories
Search
Top
Bottom

Check if on page/blog or forum

  • @koendb

    Participant

    Short question: How do I check if I’m on a page (or blog) from within ‘loop-single-reply.php’?

    WP 3.8.3
    bbpress 2.5.3
    URL: 24baby.nl

    Long question: I use bbpress for all my comments on articles and blogs: ‘Use a bbPress forum topic for comments on this post.’

    On my website this generates a first post along the lines of (my website is in Dutch): ‘This topic belongs to article <LINK>. Share your thoughts!’

    This text is visible both under the actual article and on the forums. While it’s a good way to explain the purpose of the thread on the forums, it’s confusing as the first reply on the actual article page. Because of that I don’t want to show this first reply on all my blog / page ‘pages’, but do want to show them on the forums.

    It’s fairly easy to remove the first reply within ‘loop-replies.php’, but I don’t know how to test whether I’m on the forums or not? Is_page doesn’t work, is_bbpress always returns true.

Viewing 3 replies - 1 through 3 (of 3 total)
  • @tharsheblows

    Participant

    I am totally guessing with this – but I think you’ll be using this on a single topic right? So maybe try bbp_is_single_topic() . Here is the list of conditional tags I looked at: https://codex.bbpress.org/bbpress-conditional-tags/

    @koendb

    Participant

    Thanks, but it needs to give different results for the SAME topic on different ‘pages’. When it displays below an article vs it’s own page.

    @koendb

    Participant

    I had to read better. It was in the Codex is_page() function reference.

    Had to reset the query after the loop:
    wp_reset_query(); // and after that:
    if(is_page()){ // etc.

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