• Is there a way inside this code to add something that display all but one category on a page?

    <?php
    
    add_shortcode("loop", "myLoop");
    
    function myLoop($atts, $content = null) {
    extract(shortcode_atts(array(
    "pagination" => 'true',
    "query" => '',
    "category" => '',
    ), $atts));
    global $wp_query,$paged,$post;
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    if($pagination == 'true'){
    $query .= '&paged='.$paged;
    }
    if(!empty($category)){
    $query .= '&category_name='.$category;
    }
    if(!empty($query)){
    $query .= $query;
    }
    $wp_query->query($query);
    ob_start();
    ?>
    <ul class="loop">
    <?php while (have_posts()) : $wp_query->the_post();
    /********** Edit Below This Line **********/ ?>
    <li>
    
    <h2 class="blogTitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <div class="blogMeta">by <?php echo the_author_meta('display_name'); ?> | <img src="http://www.singleinstilettos.com/wp-content/uploads/icon-comments.png" alt="Comments" align="top" border="0" /> <a href="<?php the_permalink();?>#comments"><?php comments_number( 'no responses', 'one response', '% responses' ); ?></a></div>
    
    <div class="lcp_FeaturedImage"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></div>
    
    <?php the_excerpt(); ?>
    
    <a class="blogReadMore" href="<?php the_permalink(); ?>">Read More...</a>
    
    <hr class="blogDivider" />
    
    </li>
    <?php /********** Edit Above This Line **********/
    endwhile; ?>
    </ul>
    <?php if($pagination == 'true'){ ?>
    <?php wp_pagenavi(); ?>
    <?php } ?>
    <?php
    $wp_query = null;
    $wp_query = $temp;
    wp_reset_query();
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
    }
    
    ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display All but One Category’ is closed to new replies.