Forums

How do i exclude part of the page template on post pages? (3 posts)

  1. eventindustrynews
    Member
    Posted 2 years ago #

    Hi Guys

    I am looking to exclude part of my wordpress theme on my post pages.

    you can view my site at www. eventindustrynews .co.uk and the part i want to exclude is the featured news and pouplar articles section.

    Below is my code for the single posts page

    <?php get_header(); ?>

    <!-- BEGIN home -->
    <div id="home">
    <!-- BEGIN featured -->
    <div id="featured">
    <h2>Featured News</h2>
    <?php
    $temp_query = $wp_query;
    query_posts(array('post__in'=>array(dp_settings('featured'))));
    if (have_posts()) : the_post();
    ?>
    <div class="content">
    <?php dp_attachment_image(0, 'thumbnail', 'alt="' . $post->post_title . '"'); ?>
    <h3>"><?php the_title(); ?></h3>
    <p class="date"><?php the_time('l, F j, Y') ?></p>
    <?php ob_start(); the_content(''); echo str_replace("\n", '

    ', (dp_clean(ob_get_clean(), 700))); ?>
    </div>
    <div class="details">
    " class="readmore">Read More »
    <p class="r">Filed Under: <?php the_category(', ') ?> <span class="comments"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></span></p>
    </div>
    <?php endif; ?>
    </div>
    <!-- END featured -->
    <!-- BEGIN popular -->
    <div id="popular">
    <h2>Popular Articles</h2>

      <?php dp_popular_posts(7); ?>

    </div><div class="break"></div>
    <!-- END popular -->
    </div>
    <!-- END home -->

    <!-- BEGIN content -->
    <div id="content">
    <?php
    $wp_query = $temp_query;
    if (have_posts()) : the_post();
    $arc_year = get_the_time('Y');
    $arc_month = get_the_time('m');
    $arc_day = get_the_time('d');
    ?>
    <!-- begin post -->
    <div class="single">
    <h2>"><?php the_title(); ?></h2>
    <?php the_content(); ?>

    <div class="details">
    <p class="l">Categories: <?php the_category(', ') ?></p>
    <?php the_tags( '<p class="r">Tags: ', ', ', '</p>'); ?>
    <div class="break"></div>
    </div>
    </div>
    <!-- end post -->
    <div id="comments"><?php comments_template(); ?></div>
    <?php else : ?>
    <div class="notfound">
    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that is not here.</p>
    </div>
    <?php endif; ?>
    </div>
    <!-- END content -->

    <?php get_sidebar(); get_footer(); ?>

    Can anyone help??

  2. Peter Boosten
    Member
    Posted 2 years ago #

    Leave this part out from your single.php:

    <div id="home">
    <!-- BEGIN featured -->
    <div id="featured">
    <h2>Featured News</h2>
    <?php
    $temp_query = $wp_query;
    query_posts(array('post__in'=>array(dp_settings('featured'))));
    if (have_posts()) : the_post();
    ?>
    <div class="content">
    <?php dp_attachment_image(0, 'thumbnail', 'alt="' . $post->post_title . '"'); ?>
    <h3>"><?php the_title(); ?></h3>
    <p class="date"><?php the_time('l, F j, Y') ?></p>
    <?php ob_start(); the_content(''); echo str_replace("\n", '
    
    ', (dp_clean(ob_get_clean(), 700))); ?>
    </div>
    <div class="details">
    " class="readmore">Read More ยป
    <p class="r">Filed Under: <?php the_category(', ') ?> <span class="comments"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></span></p>
    </div>
    <?php endif; ?>
    </div>
    <!-- END featured -->
    <!-- BEGIN popular -->
    <div id="popular">
    <h2>Popular Articles</h2>
    
          <?php dp_popular_posts(7); ?> 
    
    </div><div class="break"></div>
    <!-- END popular -->
    </div>
    <!-- END home -->

    Peter

  3. eventindustrynews
    Member
    Posted 2 years ago #

    Hi Peter

    Thanks, although i get the following error message when i try and view a post

    Fatal error: Call to a member function on a non-object in /home/sites/eventindustrynews.co.uk/public_html/wp-includes/query.php on line 610

Topic Closed

This topic has been closed to new replies.

About this Topic