Page Template Showing Page Content Followed by Specific Post Categories
-
Hi,
I’m using the Twenty Ten theme. I’m trying to create a page template which shows the content of the page followed by posts in specific categories. I consulted the Codex and came up with the following code:<?php /* Template Name: Page Of Specific Post Categories */ /* This is for a child theme of Twenty Ten. */ get_header(); ?> <div id="container-right" class="no-title"> <div id="content" role="main"> <?php /* The loop: the_post retrieves the content * of the new Page list the posts, */ if ( have_posts() ) : while ( have_posts() ) : the_post(); // Display content of page get_template_part( 'loop', 'page' ); wp_reset_postdata(); endwhile; endif; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( // Change these category SLUGS to suit your use. 'category_name' => 'music, videos, other', 'paged' => $paged ); $list_of_posts = new WP_Query( $args ); ?> <?php if ( $list_of_posts->have_posts() ) : ?> <?php /* The loop */ ?> <?php while ( $list_of_posts->have_posts() ) : $list_of_posts->the_post(); ?> <?php // Display content of posts ?> <?php get_template_part( 'loop', 'single' ); ?> <?php endwhile; ?> </div><!-- #content --> </div><!-- #container-right --> <?php get_footer(); ?>
However, when I run the template, I get the error message “syntax error, unexpected $end on line 47”. I have checked my code several times and I can not figure out my mistake. I would greatly appreciate your help.
Many thanks in advance.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Page Template Showing Page Content Followed by Specific Post Categories’ is closed to new replies.