WordPress.org

Ready to get started?Download WordPress

Forums

uncorrect text in tag title (11 posts)

  1. bobrock4
    Member
    Posted 1 year ago #

    Hi all,

    I have a case in which page titles in tag <title></titles> are formed with two words in the end. I would like to remove these two words but i'm not able to find where they have been originally inserted in the code.

    Thanks and ciao
    Bob

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    the meta title tag code is usually in header.php of a theme;
    look for:

    <title><?php ... ?></title>

    general: http://codex.wordpress.org/Meta_Tags_in_WordPress

    are you using a seo pugin?

  3. bobrock4
    Member
    Posted 1 year ago #

    Hi Alchymyth, thank you for your reply

    Yes, i'm using Yoast SEO, even if, in this case, it is not able to show the complete snippet preview.

    I have founf this code in header.php between <title></title>. Here I can't see what is the instruction that makes take these two unuseful words

    <?php
    	/*
    	 * Print the <title> tag based on what is being viewed.
    	 */
    	global $page, $paged;
    
    	wp_title( '|', true, 'right' );
    
    	// Add the blog name.
    	bloginfo( 'name' );
    
    	// Add the blog description for the home/front page.
    	$site_description = get_bloginfo( 'description', 'display' );
    	if ( $site_description && ( is_home() || is_front_page() ) )
    		echo " | $site_description";
    
    	// Add a page number if necessary:
    	if ( $paged >= 2 || $page >= 2 )
    		echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );
    
    	?>

    Ciao

  4. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    I have founf this code in header.php between <title></title>.

    try to reduce that code to:
    <title><?php wp_title(); ?></title>

    and let the plugin do the job.

  5. bobrock4
    Member
    Posted 1 year ago #

    Hi, I've just tried to do that (i've made a copy and paste of your code) but it comes "Parse error: syntax error, unexpected ')' in /home/softgest/public_html/wp-content/themes/software/header.php on line 28".

    Thanks and ciao

  6. Andrew
    Forum Moderator
    Posted 1 year ago #

    Although there's a syntax error in Alchymyth's code, you should know PHP before making PHP customisations.

  7. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    ouch - typo ;-(

    should read:

    <title><?php wp_title(); ?></title>

    (also corrected in my original reply)

    http://codex.wordpress.org/Function_Reference/wp_title

  8. bobrock4
    Member
    Posted 1 year ago #

    Thanks alchymyth, I 've tried and now the site is working without error.

    I have also customized the title with SEO plugin and it is correct now if you make view (html) source.

    But it is very strange that you can't see the title in the browser tab (in the upper part of the browser, with Chrome and Firefox) and instead there's the URL.

    Also using the google tool http://www.google.com/webmasters/tools/richsnippets you can't see any title.

    @Andrew Nevis, I believed that this forum is open to everyone even those that are trying to make little customizations only with its strength and the help from the community. If this is not correct here, please let me know. I'm also a forum moderator in my country and there's no access level.

    Ciao

  9. bobrock4
    Member
    Posted 1 year ago #

    Thinking well that is enclosed in the title is coming from the instruction

    echo " | $site_description"

    Should I remove it or should I remove (without other consequences) the whole

    $site_description = get_bloginfo( 'description', 'display' );
    	if ( $site_description && ( is_home() || is_front_page() ) )
    		echo " | $site_description";

    Thanks you and ciao
    Bob

  10. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    But it is very strange that you can't see the title in the browser tab (in the upper part of the browser, with Chrome and Firefox) and instead there's the URL.

    that usually happens if the meta title is empty;
    you need to make sure to add meta titles for all (web) pages using your seo plugin.

  11. bobrock4
    Member
    Posted 1 year ago #

    It sounds good :-) I'm doing that. Many thanks and ciao alchymyth

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags