mercredi 4 février 2015

If Post Title Above Content


How to check if post title is located above the content?


I currently using this code to add image above post title, but it is applied above all post titles of current page located anywhere including the title which are on below the content (ie. before comment list, next previous direction, etc.)



function abovetitle($title){

//Return new title if called inside loop
if ( in_the_loop() ) {

$x = do_shortcode('[shortcode id="'. $id . '"]');
return $x . $title;

} else {
//Else return regular
return $title;
}
}

add_filter( 'the_title', 'adt_abovetitle');




Aucun commentaire:

Enregistrer un commentaire