Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro is_singular( $post_type ) returns true when filtering on archive page

Viewing 3 posts - 1 through 3 (of 3 total)
  • Ben Davies
    #211560

    Hi there,

    I have some conditional logic that changes the display if on a blog inside page (blog is a CPT). This is getting fired when on the archive with a filter set but not when you first land on the page, eg:

    /news-and-stories/blog/?_sft_theme=culture-and-creativity
    is_singular returns true
    /news-and-stories/blog
    is_singular returns false

    Thanks for your help

    David

    Trevor Moderator
    #211578

    You would have to couple that with a test to see if the page is filtered. I am not sure of the code, but it would be something like this (replace the 12345 with the ID of the form):

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(12345)->current_query();
    if ((!$sf_current_query->is_filtered()) .....

    That might work.

    Ben Davies
    #213688

    That worked thank you very much.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘is_singular( $post_type ) returns true when filtering on archive page’ is closed to new replies.