php - Ghost post_title from my WP LOOP script -


the code below displaying title in black text before displays blue title hyperlink under it.

i want link appear.

if ( $query2->have_posts() ) {     // 2nd loop     while ( $query2->have_posts() ) {         $query2->the_post();                  if ($post->id == $do_not_duplicate)                 continue;                 $permalink = get_the_permalink($query2->post->id);                 $id = $post->id;                 $titleatribute = the_title_attribute();                 $title = get_the_title();         echo '<h2 id="post-' .$id.' ">                 <a href="'.$permalink.'" rel="bookmark" title="permanent link '.$permalink.' ">                    '.$title.'</a></h2>';     }      // restore original post data     wp_reset_postdata(); } 

for example, on website: http://skkelti.cz/, following text appears in black above link same text:

-martin davídek ml. : „fanoušci jsou vždy to, co vás žene kupředu“-

where coming , need stop appearing?

the problem the_title_attribute(). displaying value directly instead of returning it.

the function accepts echo in $args specify whether display or return value. default value true (to display it), pass false return value e.g.:

$titleatribute = the_title_attribute('echo=0'); 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -