• # March 18, 2013 at 11:02 am

    working with a theme that shows homepage blog post on the homepage towards the bottom just above the signup for newsletter section.

    The homepage section shows everything from the blog, I need to be sure passworded posts do not show at all. The theme options panel only has off or on for that section.
    Solution options are to show only a certain category like Featured-News, or to add something to exclude the passworded posts.
    Right now a password posts appears with the text asking for the password.

    Thanks for any suggestions guidance and/or code suggestions.

    < ?php
    $home_page_blog = inkthemes_get_option(‘inkthemes_home_blog_option’);
    $home_page_blog_on = “on”;
    if ($home_page_blog === $home_page_blog_on) {

    < ?php if ( inkthemes_get_option('inkthemes_blog_heading') !='' ) { ?>

    < ?php echo stripslashes(inkthemes_get_option('inkthemes_blog_heading')); ?>

    < ?php } else { ?>


    < ?php } ?>
    < ?php
    $args = array(
    ‘post_status’ => ‘publish’,
    ‘posts_per_page’ => -1,
    ‘caller_get_posts’ => 1,
    ‘order’ => ‘DESC’
    $query = new WP_Query($args);
    < ?php while ($query->have_posts()) : $query->the_post(); ?>
    < ?php
    $content = $post->post_content;
    $searchimages = ‘~]* />~’;
    /*Run preg_match_all to grab all the images and save the results in $pics*/
    preg_match_all( $searchimages, $content, $pics );
    // Check to see if we have at least 1 image
    $iNumberOfPics = count($pics[0]);
    if (($iNumberOfPics > 0) && ($count <5) ){

    < ?php
    < ?php
    // Reset Query

    < ?php } else { } ?>

    # March 18, 2013 at 12:39 pm

    This reply has been reported for inappropriate content.

    Ahhh… came up with a fix for this.
    The site is going to be using the magical plugin ‘Smart Passworded Pages’
    This was awesome, to keep thing simple and not have each site member needing a login even, they just need their own password.

    As an added layer of protection then we can make each password group also require a login, even though it will not need to be a unique login, just a login per group.

    So by making the posts ‘Private’ they stop showing on the homepage of the site, where it was showing the post and asking for a Password.

    The caveat I just thought of though (so maybe still a problem) is logged in users will still see the posts on the homepage, which was pretty much breaking the homepage layout because the images were not formatting thumbnailing correctly… hmmmm…
    What to do?
    Adjusting the above code to show only Feature posts would probably still be best and then modify the front-page.php show blog posts code.

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

You must be logged in to reply to this topic.