php - Changing array to display the_title Wordpress -


i have

    <?php      $attr = array(         'title' => 'here title',         'alt' => 'here alt attribute'     ); ?>     div class="s-o-column">         <div class="s-o-thumb"><a href="<?php echo $termlink; ?>"><?php echo wp_get_attachment_image( $term->image_id, 'standard-options-thumb',  false, $attr  ); ?></a>         <div class="s-o-title"><a href="<?php echo $termlink; ?>"><?php echo $term->name; ?></a></div>     </div> </div> 

how change title , alt say; <?php the_title(); ?> instead of "here title" or "here alt attribute"?

you should use get_the_title() instead of the_title() since get_the_title() returns title while the_title() echoes it.

$attr = array(     'title' => get_the_title(),     'alt' => 'here alt attribute' ); 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -