WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Code Question - How To php if with html & php inclusive (3 posts)

  1. iamcracks
    Member
    Posted 4 years ago #

    I'm trying to use the new thumbnail feature only on Sticky posts. So an if is_sticky seems like the obvious solution, but I'm having grief with the php and html all inside the 'if is'. But there's too many ' and " and I don't know the correct protocol when they're all present.

    I want this ......

    <a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><?php the_post_thumbnail(array(200,200), array('class' => ' fR')); ?></a>

    ...... to call only if post = sticky.

    Anyone ..?

  2. Mark / t31os
    Moderator
    Posted 4 years ago #

    Is this what you mean?

    <?php if( is_sticky() ) : ?>
    // YOUR CODE GOES HERE
    <?php endif; ?>
  3. iamcracks
    Member
    Posted 4 years ago #

    Yes, it is. I sure was trying to do it the hard way. You way is way easier. Thanks.

    I was using someone else's code which was riddled with echo 'xxx' php echo '' etc. Obviously unnecessary.

    Thanks for your help.

Topic Closed

This topic has been closed to new replies.

About this Topic