WordPress.org

Ready to get started?Download WordPress

Forums

Business Directory Plugin
[resolved] widget logic (9 posts)

  1. jankowalski
    Member
    Posted 1 year ago #

    i want to display widget just on this plugin pages. i tried this but is not working

    get_post_type() == 'wpbdp_listing'

    http://wordpress.org/extend/plugins/business-directory-plugin/

  2. businessdirectoryplugin
    Member
    Plugin Author

    Posted 1 year ago #

    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...

  3. jankowalski
    Member
    Posted 1 year ago #

    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..

  4. businessdirectoryplugin
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Jan,

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

    Where are you putting this code?

  5. jankowalski
    Member
    Posted 1 year ago #

    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...

  6. businessdirectoryplugin
    Member
    Plugin Author

    Posted 1 year ago #

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

  7. businessdirectoryplugin
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  8. livinginitaly
    Member
    Posted 1 year ago #

    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.

  9. businessdirectoryplugin
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic