Support » Fixing WordPress » Change the title of a Sticky post

  • Resolved jonfoster


    Hi everyone,
    I’m quite new to the whole WordPress thing, and haven’t had much experience with CSS either, so sorry if this is a bit obvious – or not written properly!
    Basically I’d like to know how I can make the title of Sticky posts show up differently to the title of normal posts – specifically be <h1> rather than <h2>.

    Thanks in advance,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Jackson


    You should look at using the ‘is_sticky()’ conditional in your theme.

    Rough example (not tested)

    if(is_sticky) {
      echo '<h1>'.get_the_title().'</h1>';
    } else {
      echo '<h2>'.get_the_title().'</h2>'

    Thats great – I’ll give it a go.

    Thank you!

    get_the_title() is not santized, use the_title() instead.

    <?php if( is_sticky() ) : ?>
    	<h1><?php the_title(); ?></h1>
    <?php else : ?>
    	<h2><?php the_title(); ?></h2>
    <?php endif; ?>

    Mark – that’s worked perfectly – thank you SO much.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change the title of a Sticky post’ is closed to new replies.