最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

categories - Wanting to list all Post types under a common category

programmeradmin1浏览0评论

A client has "posts" plus four custom post types on their site. He requested a way to call up a category that would be common to the CPTs and list them all. So if there is a common category of "budget", then it would display excerpts of all posts with the category of "budget" regardless of what post or CPT it is.

I found a few related topics here to help me write up a template to use on pages devoted to the few categories they want to use with this. It's on a child theme based on TwentyTwelve. The result I'm getting is the white screen of death. I've got through debugging several times and the error I get is:

Parse error: syntax error, unexpected end of file in /home/acs10047/public_html/wp-content/themes/moneysmartfamily/page-category-budgeting.php on line 53

But that's a blank line. So I don't know what's wrong here. I'm trying.

Since I'm piecing together different topics, I must be missing out on some understanding how they work together. Could someone advise me on what I'm doing here?

Here is the template code:

<?php

/** * Template Name: Category - Budgeting * * * The template for displaying all pages. * * 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();

    $args = array('post_type' => array('post','media-appearance','members-archive','money-saving-tips','review'),
    'posts_per_page' => '20',
);

    $this_query = new WP_Query( $args ); ?>


<div id="primary" class="site-content">
    <div id="content" role="main">

    <?php while ( $this_query->have_posts()) : $this_query->the_post(); {?>

        <?php if( has_post_thumbnail() && ($cat == 'budget') ): ?>
    <div class="tip-excerpt">                                     
        <h1 class="entry-title">
            <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
        </h1>

    <div class="entry-content">
        <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail', array('class' => 'alignleft')); ?></a><?php the_excerpt(); ?>
    </div>
    </div>
        <?php endif; ?>        

                <?php wp_reset_query(); ?>
            <?php  // done the foreach statement ?>


    </div><!-- #content -->
</div><!-- #primary -->
发布评论

评论列表(0)

  1. 暂无评论