WordPress: custom titles for different pages

By default, the title of a blog based on WordPress is defined within a theme with a code like the following (Please note: talk about the blog title rather than that of individual posts):

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;"><title></span> <title></span>

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;"><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></span> <? Php bloginfo ('name');?> <? Php if (is_single ()) {?> »Blog Archive <? Php}?> <? Php wp_title ();?></span>

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;"></title></span> </ Title></span>

Now, you want to associate different titles to different pages and leave the task to the blog engine to do this automatically, in which case you can use a code like the following:

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;"><title></span> <title></span>

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;"><?php if (is_home () ) { bloginfo('name'); }</span> <? Php if (is_home ()) {bloginfo ('name');}</span>

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">elseif ( is_category() ) { single_cat_title(); echo ' - ' ; bloginfo('name'); }</span> elseif (is_category ()) {single_cat_title (); echo '-'; bloginfo ('name');}</span>

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">elseif (is_single() ) { single_post_title();}</span> elseif (is_single ()) {single_post_title ();}</span>

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">elseif (is_page() ) { single_post_title();}</span> elseif (is_page ()) {single_post_title ();}</span>

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">else { wp_title('',true); } ?></span> else {wp_title ('', true);}?></span>

<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;"></title></span> </ Title></span>

This particular change is ideal for those looking for your blog a better level of optimization for search engines.

Related posts:

  1. Titles in PHP permalink
  2. Using the conditions for query UPDATE
  3. Update the URL of the domain in the WordPress database
  4. Make a URL with cURL
  5. Validate the value of a hex color with PHP
  6. Restrict input length of the DB field to park
  7. Cycling an empty array in PHP
  8. Enable Code Execution in PHP files without extensions
  9. Enter PHP in JavaScript
  10. Calculate the size of a MySQL database
This entry was posted in Webmaster, Wordpress and tagged , , . Bookmark the permalink.

Comments are closed.