Wrong post title displayed from loop

Welcome the the WordPress Stack Exchange and congrats on your first post! First off, you may not want to use query_posts() here. Second off – the_post() needs to be before the_title() as it sets up all the posts functions such as the_title(), the_permalink() etc. and queues the next post in your while loop. Your Loop … Read more

Limit the Title Length on Custom Post Type Archive Page to a Set Number of Characters

<?php echo substr(get_the_title(), 0,42) ;?> Notice the echo and the get_the_title() This will get you the result you’re looking for. Here’s an alternative to consider: I’ve always found character limits cause weird word breaks that users find confusing. WordPress has a function called wp_trim_words that you can use. <?php echo wp_trim_words( get_the_title(), 5, ‘…’ ); … Read more

Replace text in the Title

First things first, lets clean up your code: <?php $wptitle = the_title(); $wptitle = str_replace(‘&’, ‘and’, $wptitle);?><?php echo $wptitle; ?> Lets remove the PHP tag spam and put things in nice clean lines: <?php $wptitle = the_title(); $wptitle = str_replace(‘&’, ‘and’, $wptitle); echo $wptitle; ?> Now if we look at the problem, the_title, that function … Read more

how i can add title to my featured image?

I’m not sure about your question, but the below code is more correct. $attr = array( ‘title’ => get_the_title(), ‘alt’ => ‘a nice view of the ocean’, ); echo sprintf( ‘<a href=”https://wordpress.stackexchange.com/questions/281220/%s”>%s</a>’, get_the_permalink(), get_the_post_thumbnail( null, ‘post-thumbnail’, $attr ) );

change title separator

Yes, everything is simple, there is a standard wordpress options and settings of the SEO plugin, I’m involved in the standard settings, a vertical divider as to remove it entirely from the functions of the theme?