Support » Plugin: Page Restrict » Does it work with page template?

  • Hello, I’ve installed the plugin and I’m having a little problem with it. I’m not able to make it work when the page to be restricted uses a special template and not the default one…

    Even though the page is selected in the plugin options, and the “Restrict Page” option is checked in the post edition page, when I enter the page it just shows the content. If I change the template of the page to the default one, then it’s restricted.

    http://wordpress.org/extend/plugins/pagerestrict/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Andy Stratton

    (@theandystratton)

    The page template MUST be using the_content() to pull page content.

    If it’s not, you can wrap whatever the content call is with apply_filters( 'the_content', $post->post_content ); for example:

    <?php
    echo apply_filters( 'the_content', $some_variable );
    ?>

    Andy,

    Where would I put that apply filter if my custom page template does not use the content of the page but is composed entirely of content generated from custom loops within a bunch of html to lay it out … plus get_header() and get_footer()?

    Are you saying I would insert that code to apply filters in my template eventhough that template does not have the statement the_content(); ?

    In that case, what variable or function call would I put as the second parameter? Maybe I’m just having early morning fog, but this should be very simple.

    Thanks, Ron

    There is good and easy way to do that without using the plugin using user login function

    if (is_user_logged_in()) {
    // You page code goes here
    } else {
    echo "You must be logged in to view this page.";
    }

    If you want to add the login form then you can add this function:

    <?php wp_login_form( $args ); ?>

    If you want to add forget and register buttons to the login function it would be easy using html and css

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Does it work with page template?’ is closed to new replies.