• Resolved David Gard

    (@duck_boy)


    Hey all,

    Within the page single.php I am trying to add the functionality to filter by Tag/Category when the user clicks one. Is there away to filter the posts to only display those that meet the correct criteria?

    For example – at the moment, even when the Tag ‘TLA’ is clicked, adding a query String to the URL (http://dev.dynedrewett.com/?tag=tla) all of the news stories are displayed.

    Below is the code I am currently using.

    Any help or pointers greatly appriciated.

    Thanks.

    <div class="newsCol pinkLinks newsItemsList">
        <ul>
    		<?
                            $current_tag = single_tag_title("", false);
    
    			query_posts(array('cat' => $cat, 'posts_per_page' => 10, 'paged' => $_GET['paged']));
    			if(have_posts()){
    				while(have_posts()){
    					the_post();
    		?>
                <li>
    				<h3 class="news_title_padd"><a href="<? the_permalink() ?>"><? the_title() ?></a> - <small><strong><? the_time('jS F Y') ?></strong></small></h3>
                	<p>
                    	<? $post_content = explode('.', strip_tags(get_the_content())); ?>
                        <? echo $post_content[0] ?>. <a href="<?=$post->guid?>">Read more...</a>
    				</p>
    			</li>
    
    		<?
    				}
    			}
    		?>
    	</ul>
        <?php if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif; ?>
    </div>
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Filter posts by Tag/Category’ is closed to new replies.