I have the following code in my wordpress loop to display sticky posts:
<div class="blogpost">
<?php // div class for styling sticky posts on main page. ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); // Show summary of posts only. ?>
</div> <!-- end class sticky -->
</div> <!-- end class blogpost -->
I would like to style the h2 with CSS but I don’t have access to it. When I take a look at the code in firebug it looks like this:
<div class="blogpost">
<div id="post-324" class="post-324 post type-post status-publish format-standard sticky hentry category-uncategorized" <h2="">
<a href="http://mydomain.com/wordpress/?p=324">Headline of post </a>
...
</div>
</div>
Does anyone know what I have to change to get my headline h2 into the a? Thanks!
The first block of code is missing a
>after<?php post_class(); ?>. So, you should be able to style theh2once that’s fixed.If you want the
h2inside thea, you could just put it inside:<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><h2><?php the_title(); ?></h2></a>