Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is WordPress adding anchor tags automatically? I'm really puzzled, this is the code:

home.php

<div class="post-bottom">
   <?php if ( count( get_the_category() ) ) : ?>
    <span class="cat-links">
     <?php printf( __( 'Posted in %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
    </span>
    <span class="meta-sep">|</span>
   <?php endif; ?>
   <?php
    $tags_list = get_the_tag_list( '', ', ' );
    if ( $tags_list ):
   ?>
    <span class="tag-links">
     <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
    </span>
    <span class="meta-sep">|</span>
   <?php endif; ?>
   <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
   <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  </div><!-- .entry-utility -->

this is the final output: enter image description here

EDIT:

Output Source Code:

 <div class="post-bottom"> 
                       <span class="cat-links"> 
    Posted in <a href="http://localhost/wpa/category/uncategorized/" title="View all posts in Uncategorized" rel="category tag">Uncategorized</a> 

Image: enter image description here

The Posted in part has link color and behaves like a link but with no pointer.

EDIT2

Weird I deleted the_excerpt() and it seemed to fix the problem. But still can't understand what happens:

  <div class="posted-on"><?php twentyten_posted_on(); ?></div>
  <p><?php the_excerpt(); ?></p>
  <div class="post-bottom">
   <?php if ( count( get_the_category() ) ) : ?>
share|improve this question
    
Do you have any category related plugins activated? –  Bainternet Jan 28 '11 at 13:32
add comment

2 Answers

up vote 2 down vote accepted

Hi @janoChen:

The function get_the_category_list() in /wp-includes/category-template.php adds the anchors that you are asking about. You can find it on line 175 in WordPress v3.0.4.

I also notice that you posted what looks like an object inspector from Chrome or Safari. Sometimes when the code that is output is not valid HTML because of what can be contained and what cannot the object inspector will show the DOM view which differs from "View Source". You can inspect the source and see if it is different from the object inspector?

share|improve this answer
    
Thanks for answering again. I checked the source code and you were right, there's no anchor tag. But in the actual web page the Posted in... text has link color (blue) it has even link hover (black) (you can see my EDIT). So should I just remove that line in the category-template.php file? –  janoChen Jan 28 '11 at 14:05
add comment

I figured out why,

There wasn't an anchor tag which wasn't properly closed in the line above:

function new_excerpt_more($more) {
    global $post;
    return '<p class="read-more"><a href="'. get_permalink($post->ID) . '">Read more<a></p>';
}
add_filter('excerpt_more', 'new_excerpt_more', 100);
share|improve this answer
    
I had the exact same problem. I had random anchor tags showing up everything in chrome, but not anywhere in my code. I had one anchor tag closed like this <a/> instead of </a>. Once I closed it properly, it fixed all other mysterious anchor tags. Thanks! –  gdaniel Jun 12 '13 at 16:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.