WordPress.org

Ready to get started?Download WordPress

Forums

Tags won't display in posts--Help! (20 posts)

  1. NOLAgirl
    Member
    Posted 4 years ago #

    Hi,

    I'm revamping a site and when I upgraded wordpress to 2.9.2 and changed the theme, suddenly the post tags stopped displaying.

    I've tried all sorts of code snippets and have even changed back to the old theme, but they refuse to show.

    I think that replacing the wordpress file will fix the problem, but I have no idea which file it is!

    Any suggestions?

    The url is http://besthuntingbinocularsguide.com/

    Thanks!

  2. Mr E
    Member
    Posted 4 years ago #

    I would be weary of just swapping files in and out of different wp versions, if I understood you properly.

    I see the tags on the widget, are you referring to something different?

    Eric

  3. NOLAgirl
    Member
    Posted 4 years ago #

    I'd rather not swap files either, but I think it's a wordpress problem...

    I'm talking about the tags that show at the bottom of individual posts. The tag cloud is fine.

    What else do you think could be wrong?

    Think there's a plugin that would fix it?

    Monique

  4. alchymyth
    Forum Moderator
    Posted 4 years ago #

    if a theme shows tags at the bottom of a post (or otherwise) is down to the taste and decision of the theme author. however, you can edit the template files (index.php, single.php ...) and add the line that should show the tags:

    for instance, this is the (part of the) code from the default theme:
    <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></p>

    just locate the place in the code of your template files, where you want to show the tags, and add a code like the above, or similar.

    http://codex.wordpress.org/Template_Tags/the_tags

  5. NOLAgirl
    Member
    Posted 4 years ago #

    I understand that.

    However, the theme has that function, but the tags will not show. I've added 5 different variations on that code (before I came to this forum) and they still won't display.

    When the site was running 2.8.6, it showed them. I upgraded to 2.9.2 (automatically) and they no longer show...even with the same theme activated.

    I'm starting to get a little frustrated!

    What else could it be?

  6. MichaelH
    Member
    Posted 4 years ago #

    If you switch to the WordPress Default theme do you see the tags on each post?

  7. NOLAgirl
    Member
    Posted 4 years ago #

    No. Even the default theme doesn't show the tags.

    Do you think that I should replace the wordpress file that appears to be broken? I'd like to try it, but I don't know which one it is.

    I've also tried deactivating all plugins and that isn't it either...

  8. MichaelH
    Member
    Posted 4 years ago #

    Well your tag cloud is working and they link to your tag archives so can't see why the Default theme, with plugins deactivated, didn't show the tags for each post.

    Do you think that I should replace the wordpress file that appears to be broken?

    Not really a file you would 'fix'

  9. NOLAgirl
    Member
    Posted 4 years ago #

    Shoot! It's weird, isn't it?

    What would you try next?

  10. MichaelH
    Member
    Posted 4 years ago #

    Put this in your loop

    <?php
    $title = 'Tag ';
    $tags = wp_get_post_tags($post->ID);
      if ($tags) {
        foreach($tags as $tag) {
          echo '<p>' . $title . '<a href="' . get_term_link( $tag, 'post_tag' ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> has ' . $tag->count . ' post(s). </p> ';
        }
      }
    ?>

    [edit]

  11. NOLAgirl
    Member
    Posted 4 years ago #

    Still not working! What in the world?!

  12. MichaelH
    Member
    Posted 4 years ago #

    Then you're not in a $post type loop is my guess.

  13. NOLAgirl
    Member
    Posted 4 years ago #

    I put it in the index.php before the <?php endwhile; else: ?>

    Here's my index.php

    <?php get_header(); ?>
    <?php global $woo_options; ?>
    
        <!-- #content Starts -->
    	<?php woo_content_before(); ?>
        <div id="content" class="col-full">
    
        	<div id="main-sidebar-container">
    
                <!-- #main Starts -->
                <?php woo_main_before(); ?>
                <div id="main">      
    
    			<?php
    				// Exclude stored duplicates
    				$exclude = get_option('woo_exclude');
    				$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    				$args = array( 'post__not_in' => $exclude,
    							   'category__not_in' => '',
    							   'paged' => $paged );
    				query_posts($args);
    			?>
                <?php if (have_posts()) : $count = 0; ?>
                <?php while (have_posts()) : the_post(); $count++; ?>
    
                    <!-- Post Starts -->
                    <?php woo_post_before(); ?>
                    <div <?php post_class(); ?>>
    
                        <?php woo_post_inside_before(); ?>
    
                        <?php woo_image('width='.$woo_options['woo_thumb_w'].'&height='.$woo_options['woo_thumb_h'].'&class=thumbnail '.$woo_options['woo_thumb_align']); ?> 
    
                        <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
                        <p class="post-meta">
                            <span class="small"><?php _e('by', 'woothemes') ?></span> <span class="post-author"><?php the_author_posts_link(); ?></span>
                            <span class="small"><?php _e('on', 'woothemes') ?></span> <span class="post-date"><?php the_time($GLOBALS['woodate']); ?></span>
                            <span class="small"><?php _e('in', 'woothemes') ?></span> <span class="post-category"><?php the_category(', ') ?></span>
                        </p>
    
                        <div class="entry">
    
    </div></div>
                            <?php if ( $woo_options['woo_post_content_home'] == "true" ) the_content(); else the_excerpt(); ?>
                        </div>
    <?php
    $title = 'Tag ';
    $tags = wp_get_post_tags($post->ID);
      if ($tags) {
        foreach($tags as $tag) {
          echo '<p>' . $title . '<a href="' . get_term_link( $tag, 'post_tag' ) . '" title="' . sprintf( __( "View all posts in %s" ), $tag->name ) . '" ' . '>' . $tag->name.'</a> has ' . $tag->count . ' post(s). </p> ';
        }
      }
    ?>
    
                        <?php woo_post_inside_after(); ?>
    
                    </div><!-- /.post -->
                    <?php woo_post_after(); ?>
    
                <?php endwhile; else: ?>
                    <div class="post">
                        <p><?php _e('Sorry, no posts matched your criteria.', 'woothemes') ?></p>
                    </div><!-- /.post -->
                <?php endif; ?>  
    
                    <?php woo_pagenav(); ?>
    
                </div><!-- /#main -->
                <?php woo_main_after(); ?>
    
                <?php get_sidebar(); ?>
    
    		</div><!-- /#main-sidebar-container -->         
    
    		<?php get_sidebar('alt'); ?>
    
        </div><!-- /#content -->
    	<?php woo_content_after(); ?>
    
    <?php get_footer(); ?>

    Does that help? I've got my fingers crossed...By the way, I appreciate this more than you know!

  14. MichaelH
    Member
    Posted 4 years ago #

    Try putting that inside the loop in the WordPress default theme wp-content/themes/default/index.php. Then if you are using a static front page, undo that setting. T

  15. NOLAgirl
    Member
    Posted 4 years ago #

    It didn't work when I added it to the default theme either...

    I'm starting to freak out a bit...This is a client's site. He had tags in his posts, I made him upgrade (he was using 2.8.6) and now no theme will show the tags. A couple of themes do show 'Tagged with:', but the line is blank after that.

    I really have absolutely no idea what it could be.

  16. MichaelH
    Member
    Posted 4 years ago #

    Before this line

    $tags = wp_get_post_tags($post->ID);

    add

    echo '<p>!!!!!!!!!post id is '.$post->ID . '</p>';

    and see if you get a post id output.

  17. NOLAgirl
    Member
    Posted 4 years ago #

    Yes! I did.

  18. MichaelH
    Member
    Posted 4 years ago #

    Don't know what else to tell you.

  19. NOLAgirl
    Member
    Posted 4 years ago #

    Oh no! I thought we were so close!

    What would you do in this situation? There's got to be something...

  20. MichaelH
    Member
    Posted 4 years ago #

    Could try Tools->Upgrade and reupdate to 2.9.2 again. Backup before attempting (both database and files).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags