• Resolved bethdean

    (@bethdean)


    Hi All,
    I’m using a modified version of the WordPress loop, which is why I assume I’m unable to get my tags to show up. The beginning of my looks like this:

    <?php //if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<?php
    			if ($posts)
    			{
    			function stupid_hack($str)
    			{
    			return preg_replace('|</ul>\s*<ul class="linklog">|', '', $str);
    			}
    			ob_start('stupid_hack');
    			foreach($posts as $post)
    			{
    			start_wp();
    			?>

    Then I have a bunch of conditions to check what category a post is in and then to format it accordingly. Here’s a sample of one :

    <?php if ( in_category(30) ) : ?>
    
    			<div class="post twitter" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?> <?php the_date('m.d.Y'); ?>:</a></h2>
    				<div class="entry">
    					<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    			</div>

    I tried adding <?php echo single_tag_title(); ?> in post meta data but it didn’t work. Any help would be most appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php echo single_tag_title(); ?> I think is for outside the loop, though it may work there as well (not sure), but try <?php the_tags(); ?> This will add the tags currently applied to a post.

    There are some parameters you can add in: https://codex.www.ads-software.com/Template_Tags/the_tags

    Hope it helps. ??

    Thread Starter bethdean

    (@bethdean)

    Thanks for the suggestion. I actually was trying the_tags without success, which is why I thought the problem was my modified loop.

    As it turns out the loop was the problem, instances of wp_start must be replaced with the_post.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can’t get tags to work’ is closed to new replies.