Support » Plugin: WP-TopBar » Display Only On Post Pages

  • Resolved moriokfutai

    (@moriokfutai)



    Hi Bob,

    Cool little plugin. It really solved a huge issue for me!
    Can you please point me on how to display the topbar only on Post pages? Until now I was able to block it only on the homepage. Is there any way to make the topbar NOT DISPLAY on all archives pages (categories, tags, custom fields, etc …)?

    Thanks in advance.
    Regards,
    E.

    https://wordpress.org/plugins/wp-topbar/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Bob

    (@rfgoetz)

    There are two ways I do this:

    1, On one website, I just have a few pages, and mostly have posts. On the control tab, I put the Page ID’s I want to exclude in the “Page IDs:” field and set the next option (“Page ID Criteria:”) to exclude. The down side is that you have to remember to update the TopBar if you add pages.

    2. If I have a lot of pages, I give each Post a unique category. Then I put that Category in the “Category IDs:” field. The down side is that you have to remember to put this Category on all posts.

    A third way to is add Categories to pages, then excluded them like above. You need to use Plugin like: http://wordpress.org/plugins/post-tags-and-categories-for-pages/ to make that happen. I have not tried this.

    I’ll look into extending the control options to add something like “Show only these types of items: Pages | Posts | Both” with the default being Both (to be backwards compatible. That will take me a bit of time.

    Bob

    Hi Bob,

    Thanks for your speedy answer.

    A) Your solution 1) worked perfectly to no longer display the topbar on pages. But I still need to stop displaying the topbar on the category and tag pages.
    Here’s the website link: http://coolimag.com/iphone-accessories.

    B) The real issue why I wanted to stop displaying the topbar on categories and tags is that I installed a sharing plugin in the topbar (I created a widget area via PHP including and I am calling this sharing plugin via a shortcode) and, on archive pages (categories and tags), when clicked, the sharing plugin pulls the info (description, link, title) from the first post on the page and not from the page itself. This way, if the FB Share button is clicked on a tag or category page the iPhone Cases tag, the first post found on the page will be shared instead of the iPhone Case tag page.

    Do you think this behavior could be caused by the plugin ot should I look into the theme support?

    E,

    P.S. Please note that I tried 3 sharing plugins and they all have the same behavior when used in the topbar (when clicked on archive pages they share the first found post and not the page itself). Alternatively, I tried the same plugins in other widget areas and they seem to be working fine (when clicked on archive pages they share the page itself and not the first post found on the page)

    Plugin Author Bob

    (@rfgoetz)

    are you willing to code a bit of PHP?

    If so, open wp-topbar.php:

    In function wptb_check_control_options()

    Find this statement:

    if ( ! is_home() && ( $wptbOptions['show_homepage'] == "only" ) ) { return false;}

    Add this code right after it:

    if ( is_archive() ) { return false; }

    Let me know if it works, so I can add that as a control option.

    Bob

    Plugin Author Bob

    (@rfgoetz)

    I’ve coded up this change. You can now select if you want the TopBar to not show on:

    Sticky Posts
    Posts
    Pages
    Archives
    Search Pages
    404 Pages

    Are you willing to beta test for me? If so, send me your email address.

    Bob

    Hi Bob …

    Thanks for your quick answers.

    I’ll beta test it for your with pleasure 🙂

    Drop me an email via the contact for here …http://coolimag.com/about-us-contact-us

    Also … I found another strange behavior which could get some attention :). Unless I am doing something wrong this is what happens:

    – I included a php line in the php tab of the TopBar to call an adhoc widget area. I am calling a sharing plugin via this widget area.
    – When I go to a category page – ex: http://coolimag.com/iphone-accessories the sharing buttons share the info (title and link) of the first post on the archive page and not the info of the archive page itself (http://coolimag.com/iphone-accessories in our case). I tried this with two different sharing plugins and I got the same behavior – both plugins pull the share info 9title and link) of the first post on the page.

    Is it possible this behavior is caused by a wrong setting in the TopBar?
    I find it strange that two totally different plugins get the same behavior when used with the bar.

    E.

    Plugin Author Bob

    (@rfgoetz)

    I just sent you a contact-me message.

    The TopBar plugin gets called when the page gets built. So, it is probably in the first post of the Loop and that is what gets triggered when the sharing plugins are fired off.

    Bob

    Plugin Author Bob

    (@rfgoetz)

    Updated the code 5.25 that has this new option.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Display Only On Post Pages’ is closed to new replies.