WordPress.org

Forums

How to make blog show only certain category (2 posts)

  1. zwade
    Member
    Posted 2 years ago #

    I know this has been answered before, but with the theme I am working with it I am a bit lost because of how it was coded. I need my blog part to only show a certain post category, but when I insert <?php query_posts('cat=1'); ?> before the loop it doesnt work. Here is the code on the blog template:

    <div class="blog">
    
    <?php } ?>
    
    <?php if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>
    
    <div <?php post_class('post'); ?>>
    	<?php if(has_post_thumbnail()) { ?>
    	<div class="one-third column featured-image-container ajax-load-item" id="post-image-<?php echo $post->ID; ?>" data-url="<?php echo the_permalink($post->ID); ?>" data-title="<?php echo themex_title($post->post_title); ?>" data-type="post" data-id="<?php echo $post->ID; ?>"><img src="<?php echo resized_thumbnail_url($post->ID,460); ?>" class="bordered featured-image" alt="<?php the_title(); ?>" /></div>
    	<?php if($layout!='left' && $layout!='right') { ?>
    	<div class="two-third column last">
    	<?php } else { ?>
    	<div class="one-third column last">
    	<?php
    		}
    	} else { ?>
    
    	<div class="column full last">
    
    	<?php } ?>
    
    		<?php if(get_option('themex_blog_meta')!='true') { ?>
    		<div class="post-meta">
    
    			<?php _e('','absolute'); ?>
    			<div class="post-time">
    				<span class="post-day">
    					<?php the_time('j'); ?>
    				</span>
    				<span class="post-monthyear">
    					<?php the_time('M Y'); ?>
    				</span>
    			</div>
    
    			<div class="post-author">
    				<?php the_author(); ?>
    			</div>
    
    			<?php } ?>
    			<div class="post-tags">
    				<?php the_tags('  ', ' , ', '  '); ?>
    			</div>
    
    			<?php if(get_option('themex_blog_comments')!='true') { ?>
    
    			<div class="comments-meta">
    				<?php comments_popup_link( 'Add Comment', '1 Comment', '% Comments', 'post-comments', 'Comments are off for this post'); ?>
    			</div>
    
    		</div>
    		<?php } ?>
    		<h3 class="post-title"><?php the_title(); ?></h3>
    		<div class="post-excerpt">
    			<?php the_excerpt(); ?>
    		</div>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    The way it calls the loop is different from the standard wordpress way (or at least I think it is) and I am not sure how to edit this to only show category 1 on the blog section of the website.

    Any help is greatly appreciated

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    I'm sorry but as you are using a commercial theme (noted from a previous topic), you need to seek support from the theme's developer/vendor. We do not support commercial themes here.

Topic Closed

This topic has been closed to new replies.

About this Topic