Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    Hi Jan,

    I’m not sure I totally follow you–where are you putting this code? And which widgets are you restricting?

    That is the correct post type, so without more context and understanding, I’m not sure what might be going on…

    Thread Starter kowalski

    (@jankowalski)

    well i don t want to display latest entries sitewide but just on directory pages. so are you familiar with widget logic?
    usually this

    is_singular( 'book' )

    should work for plugin based on custompost types

    so i tried

    is_singular( 'wpbdp_listing' )

    but it still display my widget sitewide. i hope you got idea what am i trying to do..

    Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    Hi Jan,

    No, still not entirely following–can you provide me answers to this question?

    Where are you putting this code?

    Thread Starter kowalski

    (@jankowalski)

    in the latest listing widget.
    once you install widget logic plugin, you will see aan extra field where you can specify on which pages you wan to display the widget . so i put there is_singular( ‘wpbdp_listing’ ) but it is not working…

    Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    OK, let me ask my developer. I’m not sure about the answer to this now.

    Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    OK, got an answer:

    Though the listings are a custom post type the page where they are being displayed is just a regular page so get_post_type() is probably returning ‘page’ even when inside the directory. I’d suggest using another conditional: one that returns TRUE when the page being displayed is the directory page (the one with the short code). Suppose your directory page has ID 60, then the conditional is_page(60) should work instead of what they’re currently doing.

    i have the same problem! in short, widget logic no longer seems to recognise the is_singular( 'book' ) conditional for custom post types. is there a fix for this? thanks. the above solution does not work.

    Plugin Author Business Directory Plugin

    (@businessdirectoryplugin)

    Why does the above logic not work? If you want the widget to only display on page ID 45, is_page(45) seems to work fine on my setup. Can you provide more details about how you’re doing this and what you see?

    Also, please note that the is_singular should never have worked for the reasons outlined by my developer above.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘widget logic’ is closed to new replies.