I'm currently using <?php the_post_thumbnail('250px', array('class'=>"review-siteshot", 'alt' => get_the_title() )); ?>
I know that 'alt' => "review"
will output review as all text.
I'm trying to use get_the_title()
along with "review" so that I get title-text review as my alt text for the thumbnail.
I'm currently using <?php the_post_thumbnail('250px', array('class'=>"review-siteshot", 'alt' => get_the_title() )); ?>
I know that 'alt' => "review"
will output review as all text.
I'm trying to use get_the_title()
along with "review" so that I get title-text review as my alt text for the thumbnail.
2 Answers
Reset to default 2Like this:
'alt' => get_the_title(). ' review'
So the full code would be:
<?php the_post_thumbnail('250px', array('class'=>"review-siteshot", 'alt' => get_the_title(). ' review' )); ?>
The function the_title()
can be used to append a string and to return instead of echoing:
the_title( '', ' review', 0 )
In case stripping tags and escaping is necessary, the function the_title_attribute()
can be used:
the_title_attribute( [ 'after' => ' review', 'echo' => 0 ] )