WordPress.org

Ready to get started?Download WordPress

Forums

Add Meta Tags
[resolved] Custom title issue (10 posts)

  1. a.s.panchenko
    Member
    Posted 1 year ago #

    Hello. First of all, thanks for your plugin.

    I have this code to display title of the post/page.
    <title><?php wp_title('|', true, 'right'); bloginfo('name'); ?></title>
    And get title like this - Page name | Blogname, which is what I want. But when I use plugin to change title I lost my separators and get: Custom titleBlogname.

    Is this a plugin bug or smth.? Can I make a quick fix?

    http://wordpress.org/extend/plugins/add-meta-tags/

  2. George Notaras
    Member
    Plugin Author

    Posted 1 year ago #

    Seems like a bug. Thanks for reporting it.

    In the upcoming weekend I'll try to reproduce it using the settings you provided and resolve any issues.

  3. MFan
    Member
    Posted 1 year ago #

    I'm also using your plugin (thanks for it! it's really great) and was having the same problem. I just fixed it here and I don't think there's anything wrong with the plugin.

    In my case, I am using a custom theme based on blankslate. In that theme's horrifically, atrociously, abhorrently formatted functions.php there was this function:

    add_filter('wp_title', 'blankslate_filter_wp_title');
    function blankslate_filter_wp_title($title)
    {
    return $title . esc_attr(get_bloginfo('name'));
    }

    I just deleted that, and that solved it. So I would suggest searching your theme files for "wp_title", and see if there's a filter like this. If so, delete it, and that should do it.

  4. TidyThemes
    Member
    Posted 1 year ago #

    @MFan - Haha, it's called BlankSlate for a reason. There's nothing wrong with the formatting, because it doesn't have any. It's semi-minified (as apposed to fully minified where all lines of code would be on just one line).

    The code is like this purposefully and you'll also see the suppression of programmer comments as well. It's truly the ultimate blank slate boilerplate. You won't find anything easier out there that allows you to quickly white label and truly build your own theme.

    Open all files in TextWrangler (Mac) or Notepad++ (Win) and do a find and replace in all files for the blankslate prefix to replace with your own. Then automate the formatting however you like and adjust to your own preferences.

    We're not going to impose that onto you. The point of theme is for people to jumpstart their own theme as close to scratch as possible.

    Thanks and Enjoy

  5. George Notaras
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you all for you feedback.

    Unfortunately, due to several other obligations, it is impossible to investigate whether this is a bug or not at this time. I'll do some thorough research about what might interfere with the title generation/formatting and include any potential fixes in the upcoming 2.3.0 release.

    @MFan: Thanks for pointing that out.

  6. zstansfi
    Member
    Posted 1 year ago #

    I have the exact same problem as panchenko. One thing I noticed is that only some of my posts have the custom title merged to my blog name. Most of the posts have the correct separator | in between.

  7. Svelte Design
    Member
    Posted 11 months ago #

    Hi
    As a quick fix to this, I changed the following line of code:

    $custom_title = str_replace('%title%', $title, $custom_title);
    to
    $custom_title = str_replace('%title%', $title, $custom_title).' | ';

    Which can be found in add-meta-tags.php on line 1778

    But please bear in mind that any future updates will overwrite this

  8. George Notaras
    Member
    Plugin Author

    Posted 9 months ago #

    Changed the priority of the 'amt_custom_title_tag' filter and now it seems to work as expected.

    Please try setting:

    add_filter('wp_title', 'amt_custom_title_tag', 1000);

    It will be fixed in v2.3.0.

  9. George Notaras
    Member
    Plugin Author

    Posted 9 months ago #

    According to my tests, setting the priority of the filter high enough (1000) resolves the issue with the unwanted blog name in the custom title.

    However, if '%title%' is used within the custom title, then the blog name is still appended. The blog name is actually appended to the normal post/page title to which '%title%' is expanded. I guess this is a problem of low importance for now. Requires further manipulation of the title, which I'll try to do in another plugin release.

    I'm marking this thread as resolved.

  10. itsthomas
    Member
    Posted 1 month ago #

    I have (had) the same problem as posted by a.s.panchenko in the first post of this thread with wordpress 3.8.1 and the twenty eleven theme version 1.7.
    Even Version 2.4.3 of your plugin didn't fix the issue for me but following the advice from Svelte Design did:

    As a quick fix to this, I changed the following line of code:

    $custom_title = str_replace('%title%', $title, $custom_title);
    to
    $custom_title = str_replace('%title%', $title, $custom_title).' | ';

    Which can be found in add-meta-tags.php on line 1778

    Would be great if you could add this fix to your next update.

    Thanks a lot

    Thomas

    PS: Great plugin! Keep up the good work :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic