How to solve the site tag being displayed twice?

You are getting the two <title> tags most likely because your theme has the title-tag support which automatically adds the title tags in the document head. Excerpt from the above linked page on Make WordPress Core: Adding titles to themes Starting with 4.1 and Twenty Fifteen, the recommended way for themes to display titles is … Read more

Setting page title and keywords from PHP code

You can use the wp_title filter to modify the HTML document title, and you can use the wp_head action to hook in a custom HTML meta link. e.g.: <?php function wpse46249_filter_wp_title( $title ) { // $title contains the default document title // output by WordPress. Modify it here however // you want. $some_custom_title_content=”CUSTOM TITLE CONTENT … Read more

Title tags show twice

Go to the header.php file in your template folder and make sure that between the title tags, there’s only this code: <?php wp_title(”);?> That should do the trick. This error is a combination of your template files with standard settings of the Yoast SEO plugin.

set title attribute in wp_get_attachment_image()

In a relatively fresh install I can’t replicate the issue. When I post your code with my own image ID I get the title=”My Custom Title” attribute. It’s important to note however that the “Title” of an image in the media library is not output as a title attribute in the standard output of wp_get_attachment_image(). … Read more

How to echo all the_title() without text after last “-“

This is really a PHP question not so much a WP question — but: echo substr($stringx,0,strrpos($stringx,’-‘)); Also I think your example #3 is wrong unless there are some cases where you want to exclude more than simply after the final dash character. Note – if you want to exclude both that final blank space along … Read more

Wrap the_title_attribute in a H2 within a Conditional Tag?

The the_title_attribute() template tag is intended specifically for outputting the Title formatted for use in an anchor tag title attribute. The the_title() and get_the_title() template tags are intended for general print/display of the Title. I would recommend using get_the_title(), rather than the_title_attribute(). To wit: elseif( get_post_type($post->ID) == ‘press’ ){echo'<h2>’. get_the_title() .'</h2>’;} I believe this would … 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

Cannot use ‘CSS’ in post title

Disable all plugins. One of them puts all words with capital letters in a <span class=”caps”> container. In <meta property=”og:title” content=”test <span class=”caps”>CSS</span> title” /> … this closes the <head> section automatically because output is not allowed in <head>. If you have found the plugin tell its author about the Bug. I’m sure s/he wants to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)