WordPress.org

Ready to get started?Download WordPress

Forums

Scroll Triggered Boxes
[resolved] Correct way to use 'if Post Type is'? (6 posts)

  1. tapeasy
    Member
    Posted 6 months ago #

    Hi Danny,

    I'm trying to exclude a custom post type 'reviews' and only show the box on post types 'post' and another custom post type 'question'.

    Specifying post, question in the text box against 'if Post Type is' isn't working and the scroll box shows up on all post types, including reviews.

    I wonder if there is a different way to specify post types.

    Thanks so much for your help! :)
    Sonal

    https://wordpress.org/plugins/scroll-triggered-boxes/

  2. Danny van Kooten
    Member
    Plugin Author

    Posted 6 months ago #

    Hi Sonal,

    Is your "if post type is" rule defined as follows?

    post, question

    If it is and it's still not working, please let me know. It would mean it's a bug I'll have to look into.

    In the meantime you should be able to use the following manual conditional rule.

    get_post_type() !== 'reviews'

    or

    get_post_type() === 'post' || get_post_type() === 'question'

    Hope that helps!

  3. tapeasy
    Member
    Posted 6 months ago #

    Hi Danny, yes, this is how the rule looks like:

    if Post Type is post, question

    I did not use single quotes around them.

    I'm afraid neither of the get_post_type rules are working either. is_single() works, but then every custom post type gets included with that. It would be wonderful to be able to exclude 'reviews', in my case.

    You're doing an amazing job with this plugin and I'll appreciate any pointers you can provide.

    Sonal

  4. worthdesigning
    Member
    Posted 4 months ago #

    I've got the same problem.

    My template has an FAQ custom post type and a Portfolio custom post type so the box is showing on these types of posts, which I don't want.

    I tried - if Post type is .... get_post_type() === 'post'

    The form doesn't show up on the custom posts - but not on my blog posts either! I'm not a php expert so not sure what to put in that will work.

    Thanks, in advance :)

  5. Danny van Kooten
    Member
    Plugin Author

    Posted 4 months ago #

    Hi there,

    You can remove the get_post_type() call altogether. So, the following setting should just work.

    If post type is ... post

    The only thing you need to enter in the box is 'post'. :-)

    Hope that helps. If not, let me know!

  6. worthdesigning
    Member
    Posted 4 months ago #

    Awesome - fixed.

    Thanks Danny :)

Reply

You must log in to post.

About this Plugin

About this Topic