WordPress.org

Forums

Separate Category Blogroll AND Standard Page.php all-in-one (1 post)

  1. comforteagle03
    Member
    Posted 2 years ago #

    Alright so here's what I want to do...

    I know how to make a separate page template that'll show only posts from one category, however beneath that I'd like it to also show the contents of that page (the one that was told to use that page template). If that makes any sense...

    Reason, I don't want to require the person using it regularly to have to get into the editor and possibly mess things up. I'd like it to be so they only go to the "Example" page and edit the page contents (what shows beneath the blogroll)

    All I can ever get is the limited blogroll as expected, however underneath it there's only one post. Not the contents of the "Example" page.

    Here's how the code looks:

    <?php
    /*
    Template Name: example
    */
    ?>
    
    <?php get_header(); ?>
                    <div id="container">
                            <div id="content">
    <?php get_sidebar(); ?>
    
    <!-- specialized posts -->
    		<?php query_posts('category_name=example&showposts=2'); ?>
        	<?php while ( have_posts() ) : the_post() ?>
    
            <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    			<h2 class="entry-title"><?php the_title(); ?></h2>
                <div class="entry-summary">
                	<p><?php the_excerpt(); ?><?php _e('Posted by', 'me'); ?> <?php the_author(); ?> <?php _e('on', 'me'); ?> <?php the_time('M d, Y') ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php _e('Read this post', 'me'); ?></a> <?php edit_post_link('Edit', ' | ', ''); ?></p>
                </div><!-- entry-summary -->
            </article>
            <?php endwhile ?>
    <!-- end specialized posts -->
    
    <!-- begin regular page -->
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<header class="entry-header">
    		<h1 class="entry-title"><?php the_title(); ?></h1>
    	</header><!-- .entry-header -->
    
    	<div class="entry-content">
    		<?php the_content(); ?>
    		<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'me' ) . '</span>', 'after' => '</div>' ) ); ?>
    	</div><!-- .entry-content -->
    	<footer class="entry-meta">
    		<?php edit_post_link( __( 'Edit', 'me' ), '<span class="edit-link">', '</span>' ); ?>
    	</footer><!-- .entry-meta -->
    </article><!-- #post-<?php the_ID(); ?> -->
    
    <!-- end regular page -->
    
    						</div><!-- #content -->
                      </div> <!-- container -->
    
    <!-- Footer contents-->
    
    <?php get_footer(); ?>

    Thanks in advance!

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by comforteagle03
  • This topic is not resolved
  • WordPress version: 3.4.2