Example #1
0
  <!-- 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');
?>
      <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        mystique_post();
    }
    mystique_pagenavi();
} else {
    ?>
       <h1 class="title error"><?php 
    _e("No posts found", "mystique");
    ?>
</h1>
       <p><?php 
    _e("Sorry, but you are looking for something that isn't here.", "mystique");
    ?>
</p>

      <?php 
}
Example #2
0
function mystique_queryposts($atts)
{
    extract(shortcode_atts(array('category_id' => '', 'category_name' => '', 'tag' => '', 'day' => '', 'month' => '', 'year' => '', 'count' => '5', 'author_id' => '', 'author_name' => '', 'order_by' => 'date'), $atts));
    $output = '';
    $query = array();
    if ($category_id != '') {
        $query[] = 'cat=' . $category_id;
    }
    if ($category_name != '') {
        $query[] = 'category_name=' . $category_name;
    }
    if ($tag != '') {
        $query[] = 'tag=' . $tag;
    }
    if ($day != '') {
        $query[] = 'day=' . $day;
    }
    if ($month != '') {
        $query[] = 'monthnum=' . $month;
    }
    if ($year != '') {
        $query[] = 'year=' . $year;
    }
    if ($count) {
        $query[] = 'posts_per_page=' . $count;
    }
    if ($author_id != '') {
        $query[] = 'author=' . $author_id;
    }
    if ($author_name != '') {
        $query[] = 'author_name=' . $author_name;
    }
    if ($order_by) {
        $query[] = 'orderby=' . $order_by;
    }
    ob_start();
    $backup = $post;
    $posts = new WP_Query(implode('&', $query));
    if ($posts->have_posts()) {
        while ($posts->have_posts()) {
            $posts->the_post();
            mystique_post();
        }
    } else {
        echo '<p class="error">[query] ' . __("No posts found matching the arguments", "mystique") . '</p>';
    }
    $post = $backup;
    wp_reset_query();
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}