• Hello everyone!

    Could any kind soul let me know how to have a password-protected static page with all blog posts that is different from the homepage (also static)?

    When I do this from the backend, the static page stops being pass-protected when I assign it to be my posts page from the drop-down menu of on the reading settings dashboard.

    Thanks, folks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Duplicated your problem and reported via Trac Ticket 7862.

    Might have to password protect each post in the meantime.

    Hi, was this ever resolved? I’m having the same problem

    Peter

    (@parable)

    Hi,
    You cannot use the default wordpress setting to password protect your static page that you then set as your posts page if you follow.

    You need to set a custom template for your posts page.
    Create a new blank plain text document call it postpage.php and save it within
    /wp-content/themes/**the name of the theme your using/**

    Then when you create the page to show your posts in choose postpage as the template.

    As raw PHP put in the following to the blank text document postpage.php
    so you don’t get your themes formatting with this;

    <?php
    /*
    Template Name: postspage
    */
    ?>
    <?php get_header(); ?>
    <?php
    $lastposts = get_posts();
    foreach($lastposts as $post) :
    setup_postdata($post);
    ?>
    <div class=”item”>
    <h2><?php the_title(); ?></h2>
    <p class=”date”><?php the_time(‘j.m.Y’) ?></p>
    <?php the_content(); ?>
    </div>
    <?php endforeach; ?>
    <?php get_sidebar(); ?>
    <?php include (TEMPLATEPATH . “/footer.php”); ?>

    To add in your themes formatting you’ll need to copy the code from index.php within your themes folder and insert the above php in the right place. This would look something like this:
    <?php
    /*
    Template Name: postspage
    */
    ?>
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”&gt;
    <html xmlns=”http://www.w3.org/1999/xhtml&#8221; <?php language_attributes() ?>>
    <head>
    <?php get_header(); ?>
    </head>
    <body>
    <div class=”main”>
    <div class=”container”>
    <?php include (TEMPLATEPATH . “/head.php”); ?>

    <div class=”content span-24″>
    <div class=”posts span-17 last”>
    <?php include (TEMPLATEPATH . “/banner.php”); ?>

    <div class=”paddings”>
    <?php
    $lastposts = get_posts();
    foreach($lastposts as $post) :
    setup_postdata($post);
    ?>

    <ul class=”items”>
    <h2><?php the_title(); ?></h2>
    <p class=”date”><?php the_time(‘j.m.Y’) ?></p>
    <?php the_content(); ?>

    • <?php include (TEMPLATEPATH . “/item.php”); ?>
    • <?php endforeach; ?>

    • <?php include (TEMPLATEPATH . “/missing.php”); ?>
    • <div class=”navigation”>
      <div class=”fl”><?php next_posts_link(__(‘« Older Entries’, ‘default’)) ?></div>
      <div class=”fr”><?php previous_posts_link(__(‘Newer Entries »’, ‘default’)) ?></div>
      <div class=”clear”></div>
      </div>
    • </div>
      </div>

      <?php get_sidebar(); ?>
      </div>
      <div class=”clear”></div>

      <?php include (TEMPLATEPATH . “/footer.php”); ?>
      </div>
      </div>
      </body>
      </html>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Static Page with Password & Articles’ is closed to new replies.