Mystique Page of Posts (4 posts)

  1. millennialwave
    Posted 5 years ago #

    I'm trying to add a "page of posts" (short content at the top followed by the most recent posts) to the Mystique Theme. Specifically, I'd like to choose the "News" category of posts for this page.

    I've added a pageofposts.php into the wp-content/themes/mystique/directory. This file contains the following code found on http://wordpress.org/support/topic/pageofposts-template-for-mystique-theme-wanted-here-you-go?replies=1

    Template Name: PageOfPosts adapted for "mystique" Theme by http://digitalnature.ro
    Author: orjo.net
    get_header(); ?>
       <!-- main content: primary + sidebar(s) -->
      <div id="main">
       <div id="main-inside" class="clear-block">
        <!-- primary content -->
        <div id="primary-content">
         <div class="blocks">
           <?php do_action('mystique_before_primary'); ?>
    if (is_page() ) {
    $category = get_post_meta($posts[0]->ID, 'category', true);
    if ($category) {
      $cat = get_cat_ID($category);
      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
      $post_per_page = 4; // -1 shows all posts
      $do_not_show_stickies = 1; // 0 to show stickies
        'category__in' => array($cat),
        'orderby' => 'date',
        'order' => 'DESC',
        'paged' => $paged,
        'posts_per_page' => $post_per_page,
        'caller_get_posts' => $do_not_show_stickies
      $temp = $wp_query;  // assign orginal query to temp variable for later use
      $wp_query = null;
      $wp_query = new WP_Query($args); 
            if (have_posts()):
             while (have_posts()):
           <?php do_action('mystique_after_primary'); ?>
        <!-- /primary content -->
        <?php get_sidebar(); ?>
    	$wp_query = $temp;  //reset back to original query
    }  // if ($category)
      <!-- /main content -->
    <?php get_footer(); ?>

    This successfully enables the "PageOfPosts" template option for new pages. However after I select this template option for my "News" page, two things happen:
    1) my page sidebars disappear, and
    2) no posts tagged in the "News" category show up on the page. No posts show up at all.

    By the way, my custom field name is News and my custom field value is News.

    I'd appreciate your help because I bet there are some simple explanations and fixes.


  2. digitalnature
    Posted 5 years ago #

    why don't you use the [query] shortcode instead?

  3. millennialwave
    Posted 5 years ago #

    WOW. I totally just overlooked it. So simple; your theme rocks, by the way. Thanks for the ongoing support!

  4. plonka2000
    Posted 5 years ago #

    Thanks so much!
    I've been trying to figure this out for days and just found out about this [query] shortcode!

    Thanks, and your theme rocks here too!

Topic Closed

This topic has been closed to new replies.

About this Topic