Give help. Get help.

  • # May 7, 2013 at 12:06 pm

    Hi all.

    My client has a blog area in their site. They have two main categories, ‘dealer blogs’ and ‘public blogs’. Ideally, we want both logged in and logged out users to be able to go to the same page and see rather a) just public blogs, or b) both public, and ‘dealer only’ blogs.

    I have installed the plugin ‘user specific content’ and this seems to do what we need it to for the most part, however the plugin does NOT hide the blog completely, just shows a message saying ‘you must be logged in to view this content’. Also, the featured image still shows regardless of being logged in/out.

    the link: []( “”)

    If we could hide the ‘dealer’ category entirely when not logged in this would save all the hassle.

    Please keep in mind that we are using a purchased theme, and would like to avoid directly changing their code. We do have access to our own custom JS, CSS, and functions files.

    Thank you very much, and I apologize for the long post.

    # May 7, 2013 at 12:23 pm

    You shouldn’t really need a plugin for this. You just need to use this:

    < ?php if ( is_user_logged_in() ) { ... } ?>


    Inside your `is_user_logged_in` conditional, you can run the loop for your dealer blogs. Just have to make sure that you also use it on the actual single pages so that logged out people can’t see the single posts, either.

    So you’d do something like:

    < ?php if ( !is_user_logged_in() && is_category( 'Dealer Blog' ) ) {
    echo ‘Sorry, you need to be logged in to view this post. Log in.‘;
    } ?>

    # May 7, 2013 at 12:46 pm

    @thedoc, This is exactly what I would do in a normal scenario, but I don’t want to edit the themes files. I am still relatively new with custom functions, is there a way to hook into the blog page with a custom function to accomplish this?

    I just don’t want my client to run an update, and my changes be overwritten.


    # May 7, 2013 at 12:51 pm

    I’m not sure I understand, what theme are you using that you think is going to overwritten?

    # May 7, 2013 at 3:08 pm

    The theme I am using is []( “”)

    My understanding of theme’s is that if you edit the core theme files and there is an update, the update will override my changed UNLESS it is in the custom_css/js/function files.


    # May 7, 2013 at 3:10 pm

    @thedoc isn’t talking about changing the core files but rather the theme.

    Core files will be overwritten but theme files will not.

    Therefore, anything inside the themes folder will not be overwritten. Hope that clears things up for you.

    # May 7, 2013 at 3:24 pm

    Although, you *can* get theme updates as well. I think what people normally do here is create a child theme that has all of their changes in it, but I’ve never done that before.

    # May 8, 2013 at 9:22 am

    Beautiful, thanks for the clarification everybody.

    I must look into child themes!
    @scottnix, pre_get_posts looks like the perfect solution, thanks!

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.