WordPress.org

Support

Support » Plugins and Hacks » Plugin not working on posts page

Plugin not working on posts page

  • Wonderful Wanderings
    Member

    @wonderful-wanderings

    Hi there,

    I’m using this plugin, but I have to make pages of the posts I don’t want to show because the plugin isn’t working everywhere for posts…
    I want to be able to hide my posts everywhere, except from searches and search engines, but when I use WP Hide Post, the posts still show up ion my blog page (which isn’t my home page) AND when I go through my posts using ‘next/previous post’.

    This is pretty annoying as I’m now stuck with a bunch of hidden pages that should actually be posts

    http://wordpress.org/plugins/wp-hide-post/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Wonderful Wanderings
    Member

    @wonderful-wanderings

    Anyone?

    IanLeslie
    Member

    @ianleslie

    I see the same thing. This plug-in was doing just what I wanted until I switched to a static front page. Now the blog page shows the hidden posts even though I don’t want them there.

    sliceofpie
    Member

    @sliceofpie

    I think I’ve found a solution, but it involves hacking the plugin.
    You need to replace is_front_page() with is_home() in wp-hide-post.php line 60:

    function wphp_is_front_page() {
    	return is_front_page();
    }

    Should be:

    function wphp_is_front_page() {
    	return is_home();
    }

    Excellent – I can confirm that the change above works.

    Unfortunately I can’t confirm that this code change worked. I still see the hidden post, when opening a listed post.

    MaureenBriard
    Member

    @maureenbriard

    Wow, thanks sliceofpie. I was looking for a solution to this problem and your code snippet appears to have done the trick. Great.

    Thanks sliceofpie that worked for me

    Yes, I can confirm that the code works for me as well.

    Code snippet worked for me as well.

    dubpluris
    Member

    @dubpluris

    Worked for me too. Seems like this should be included in the plugin as its pretty common for the blog not to be the homepage. Thanks!!

    This hack worked for me for a little while, but now my hidden posts are showing again. I still have the correct code in the php file. function wphp_is_front_page() {
    return is_home();
    }
    Any thoughts?

    is_front_page() and is_home() return different results depending on who is displaying your posts list (the “homepage” or the “blog page”).

    That’s why one works for some while the other for others.
    Changing to

    return is_home() || is_front_page()

    will match both cases (but may match too much).

    See http://codex.wordpress.org/Function_Reference/is_home for reference.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Plugin not working on posts page’ is closed to new replies.