WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Twelve Page of Posts Question (1 post)

  1. Tim W
    Member
    Posted 5 months ago #

    We have a custom post type with a slug of "obituaries". I'm trying to add the obituary posts to a tribute page, but it tells me there are no results.

    The tribute page is here:

    http://amvets79.nuggetweb.com/tribute-to-our-heroes/

    We have an obit added:

    http://amvets79.nuggetweb.com/obituaries/ralph-w-juhl/

    And here is the custom page template I'm trying to make work. I need it to display the content already on the tribute page, followed by a list of obituaries:

    <?php
    /**
     * Template Name: Obituaries Page Template
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages
     * and that other 'pages' on your WordPress site will use a
     * different template.
     *
     * @package WordPress
     * @subpackage Twenty_Twelve
     * @since Twenty Twelve 1.0
     */
    
    get_header(); ?>
    
    	<div id="primary" class="site-content">
    		<div id="content" role="main">
    
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', 'page' ); ?>
    				<?php comments_template( '', true ); ?>
    			<?php endwhile; // end of the loop. ?>
    
    <!-- Begin edits for obits -->
    <!--    </div> --><!-- #content -->
    <!--	</div> --><!-- #primary -->
    
    <!--
            <div id="primary" class="content-area">
    		<div id="content" class="site-content" role="main">
    -->
            <?php
                wp_reset_query();
                $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                $args= array(
                    'category_name' => 'obituaries', // Change this category SLUG to suit your use; or see for query parameters http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
                    'paged' => $paged
    );
                query_posts($args);
                if( have_posts() ) : ?>
    
                <?php while ( have_posts() ) : the_post(); ?>
                    <?php get_template_part( 'content', get_post_format() ); ?>
                    <?php comments_template( '', true ); ?>
                <?php endwhile; // end of the loop. ?>
    
                <?php twentytwelve_content_nav( 'nav-below' ); ?>
    
                <?php else : ?>
                <article id="post-0" class="post no-results not-found">
                    <header class="entry-header">
                        <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
                    </header>
                    <div class="entry-content">
                        <p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
                        <?php get_search_form(); ?>
                    </div><!-- .entry-content -->
                </article><!-- #post-0 -->
    
                <?php endif; wp_reset_query(); ?>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

Reply

You must log in to post.

About this Topic