WordPress.org

Ready to get started?Download WordPress

Forums

Tags not showing (12 posts)

  1. Godheval
    Member
    Posted 5 years ago #

    Hi,

    I am trying to use "the_tags", but for some reason, tags will not appear on my main index page. Yet it works for single posts. The strange thing is that you can see where the tags are SUPPOSED to be (the empty white box at the end of the post).

    Can someone take a look at my code and tell me the problem? Please?

    http://www.godheval.net

    Thanks in advance for any help...

  2. scribu
    Member
    Posted 5 years ago #

    Did you put the template tag in The Loop (before endwhile;) ?

  3. Godheval
    Member
    Posted 5 years ago #

    The code I'm using is as follows (minus my template-specific styles and html):

    <?php /*$posts = get_posts('numberposts=10');*/ ?>

    <?php foreach ($posts as $post) : ?>

    <?php setup_postdata ($post); ?>

    <?php if (get_option ('photon_index_post_length') == "full"): ?>

    <?php the_content('Continue Reading','FALSE',''); ?>

    <p class="tags"><?php the_tags('Tags: ', ', ', ''); ?></p>

    <?php else: ?>

    <?php the_content (); ?>

    </div>

    <?php endif; ?>

  4. Godheval
    Member
    Posted 5 years ago #

    WP Version 2.7, Photon Theme, 8 Plugins (including show/hide w/ javascript)

  5. scribu
    Member
    Posted 5 years ago #

    Why don't you use query_posts() and a standard loop instead? That might fix the problem.

  6. Godheval
    Member
    Posted 5 years ago #

    I don't even know what any of that means. What I'm using is either native to the Photon theme, or may have to do with the show/hide plugin I'm using.

    What line of code would I replace? And with what?

  7. scribu
    Member
    Posted 5 years ago #

    <?php
    query_posts('showposts=10');
    while ( have_posts() ) : the_post();
      if ( "full" == get_option('photon_index_post_length') ) {
        the_content('Continue Reading','FALSE','');
        the_tags('<p class="tags">Tags: ', ', ', '</p>');
      } else {
        the_content('');
      }
    endwhile;
    ?>

    (not tested)

  8. Godheval
    Member
    Posted 5 years ago #

    First, let me say thanks scribu for your individual attention on this matter. I really appreciate it.

    So I tried that code, but it doesn't work. However, I think it's because it's conflicting with other pieces of my code that I didn't write above. This time I'll just put the whole main index template, including the styles.

    I think your code may work, but it just has to be broken up - and I don't know enough about PHP syntax to do it.

    <?php get_header(); ?>
    
    <?php get_sidebar(); ?>
    
    <div id="wrapper">
    
    <?php /*$posts = get_posts('numberposts=10');*/ ?>
    
            <div id="posts" class="excerpts">
    
                    <ul>
    
                    <?php foreach ($posts as $post) : ?>
    
                            <?php setup_postdata ($post); ?>
    <div class="contentbox">
    
    <div id="post-meta">
    	<h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    <div class="timedate"><?php the_time('F j, Y'); ?></div>
    <div class="postdata">
    Posted by <?php the_author_posts_link(); ?><?php _e(" in "); ?><?php the_category(', ') ?> <span style="color:#F00;">♦</span> <?php comments_popup_link(__('Leave a Comment'), __('View Comments (1)'), __('View Comments (%)'), '', __('--'));  ?> <span style="color:#F00;">♦</span> <?php edit_post_link(__('Edit')); ?>
    <?php wp_link_pages(); ?>
    </div>
    
    </div>
    
                            <?php if (get_option ('photon_index_post_length') == "full"): ?>
    
                    <?php the_content('Continue Reading','FALSE',''); ?>
    
    <p class="tags"><?php the_tags('Tags: ', ', ', ''); ?></p>
    
    </div>
    
                            <?php else: ?>
    
                                    <?php the_content (); ?>
    
    </div>
    
                            <?php endif; ?>
    
    <div>
    
            </div>
    
                            </li>
    
                    <?php endforeach; ?>
    
                            <div>
                                <p style="float: left"><?php previous_posts_link(); ?></p>
                                <p style="float: right"><?php next_posts_link(); ?></p>
                                <p style="clear: both">&nbsp;</p>
                            </div>
    
                    </ul>
    
            </div>
    
    </div>
    
    <?php get_footer(); ?>
  9. scribu
    Member
    Posted 5 years ago #

    <?php get_header(); ?>
    
    <?php get_sidebar(); ?>
    
    <div id="wrapper">
    
            <div id="posts" class="excerpts">
    
    <ul>
                    <?php while (have_posts()) : the_post(); ?>
    <div class="contentbox">
    
    <div id="post-meta">
    	<h1><a>" rel="bookmark"><?php the_title(); ?></a></h1>
    <div class="timedate"><?php the_time('F j, Y'); ?></div>
    <div class="postdata">
    Posted by <?php the_author_posts_link(); ?><?php _e(" in "); ?><?php the_category(', ') ?> <span style="color:#F00;">♦</span> <?php comments_popup_link(__('Leave a Comment'), __('View Comments (1)'), __('View Comments (%)'), '', __('--'));  ?> <span style="color:#F00;">♦</span> <?php edit_post_link(__('Edit')); ?>
    <?php wp_link_pages(); ?>
    </div>
    
    </div>
    
                            <?php if (get_option ('photon_index_post_length') == "full"): ?>
    
                    <?php the_content('Continue Reading','FALSE',''); ?>
    
    <p class="tags"><?php the_tags('Tags: ', ', ', ''); ?></p>
    
    </div>
    
                            <?php else: ?>
    
                                    <?php the_content (); ?>
    
    </div>
    
                            <?php endif; ?>
    
    <div>
    
            </div>
    
                    <?php endwhile; ?>
    
                            <div>
                                <p style="float: left"><?php previous_posts_link(); ?></p>
                                <p style="float: right"><?php next_posts_link(); ?></p>
                                <p style="clear: both">&nbsp;</p>
                            </div>
    
    </ul>
            </div>
    
    </div>
    
    <?php get_footer(); ?>
  10. Godheval
    Member
    Posted 5 years ago #

    Nope, that doesn't work either.

    I had to correct one line.

    <h1><a>" rel="bookmark"><?php the_title(); ?></a></h1>

    to:

    <h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>

    Still didn't make the tags appear. And now, actually, the tags aren't showing on my single posts, either. Argh.

  11. AsraiLight
    Member
    Posted 5 years ago #

    Did you ever find a solution to this problem? I'm having the same issue...calling the tags works in the single post, but not on my homepage.

    I am so confused...

  12. AsraiLight
    Member
    Posted 5 years ago #

    I found the answer (that works for me) here.

Topic Closed

This topic has been closed to new replies.

About this Topic