WordPress.org

Ready to get started?Download WordPress

Forums

single_cat_title return nothing (5 posts)

  1. ogonkov
    Member
    Posted 5 years ago #

    Strange things with me and WordPress today.

    <?php single_cat_title(); ?> return nothing inside loop. Please, what wrong here?

    Full Code:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
    			<h2><?php the_title(); ?></h2>
    			<div class="entry">
    <?php single_cat_title(); ?>
    				<?php the_content('<p class="serif">' . __('Read the rest of this entry &raquo;', 'kubrick') . '</p>'); ?>
    
    				<?php wp_link_pages(array('before' => '<p><strong>' . __('Pages:', 'kubrick') . '</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    				<?php edit_post_link(__('Edit this entry', 'kubrick'),'','.'); ?>
    			</div>
    		</div>
    	<?php comments_template(); ?>
    	<?php endwhile; else: ?>
    		<p><?php _e('Sorry, no posts matched your criteria.', 'kubrick'); ?></p>
    <?php endif; ?>
  2. Mike Toppa
    Member
    Posted 5 years ago #

    This one's in the docs:

    Can be used only outside The Loop.

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

    If you don't mind having the category linked, the simplest solution is probably to use the_category instead:

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

  3. ogonkov
    Member
    Posted 5 years ago #

    Whoa. I will put it outside of code above, and it's still return nothing...

  4. ogonkov
    Member
    Posted 5 years ago #

    bump

  5. ogonkov
    Member
    Posted 5 years ago #

    Here i go
    http://wordpress.org/support/topic/147501

    Don't mind, that single.php can cause it.

Topic Closed

This topic has been closed to new replies.

About this Topic