• My theme automatically displays posts from various categories on the homepage based on category numbers I input on the theme settings page. Does anyone know how I would modify the code so that it displayed posts by tag instead? I would type in the tags on the theme settings page. Here is the code currently on the main index for this:

    <!-- BEGIN category posts -->
    	<div class="category">
    
    		<?php
    		$categories = get_categories('hide_empty=1&include=' . fs_settings('home_categories'));
    		foreach ($categories as $category) :
    		query_posts('showposts=' . fs_settings('home_category_length') . '&cat='.$category->cat_ID);
    		if (have_posts()) : $count = 0;
    		?>
    		<div class="box">
    		<h2><?php echo $category->name ?></h2>
    		<ul>
    		<?php
    		while (have_posts()) : the_post(); $count++;
    		$titlewidth = 22;
    		?>
    		<li<?php if ($count==1) echo ' class="first"'; ?>>
    			<a href="<?php the_permalink(); ?>"><?php echo fs_clean($post->post_title, $titlewidth); if (strlen($post->post_title)>$titlewidth) echo '...'; ?></a>
    			<a class="attachment" href="<?php the_permalink(); ?>"><?php fs_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a>
    			<p><?php echo fs_clean($post->post_content, 105); ?>...</p>
    		</li>
    		<?php endwhile; ?>
    		</ul>
    		<p class="note"><a href="<?php echo get_category_link($category->cat_ID); ?>"><?php fs_lang("More from this category"); ?></a></p>
    		</div>
    		<?php endif; endforeach; ?>
    
    	</div>
    	<!-- END category posts -->

    I hope this is doable!!

  • The topic ‘call posts by tag instead of by category’ is closed to new replies.