• ResolvedPlugin Author George Notaras

    (@gnotaras)


    Hey Jeff,

    I had asked a mod to lock the announcement topic and most probably your posts have been deleted. However, I got the requests in my inbox and I’m re-posting them here.

    I’m sorry for any inconvenience.

    Hello,

    It appears to work great on regular pages, Woo Commerce products, and the custom page for the list of postings. However, I am encountering two problems:

    1. Even though I am setting the override Title on each page/post, it is not being used in twitter:title meta tag. Instead the H1 (“title”) of the page/post is being used.

    2. My home page is not generating any twitter:title meta tags.

    I do have custom posts and home pages, and have selected those options and edited those pages directly.

    Using the Card Validator: https://cards-dev.twitter.com/validator

    http://southeast.io <- does not work (no twitter tags)
    http://southeast.io/specials/ <– (twitter:title meta tag drawing from H1, not the custom Title field)
    http://southeast.io/newsletter/ <– (twitter:title meta tag drawing from H1, not the custom Title field)

    I changed the file:
    amt_twitter_cards.php, line 99

    From

    if ( amt_is_default_front_page() ) {

    To

    if ( amt_is_default_front_page() || amt_is_static_front_page() ) {

    And I got the card to generate, but it is pulling Title and Description from the site itself (blog info), and not getting the override info.

    Note that I am still very interested in getting the Title tag (both meta title and twitter:title) to draw from the override field provided by the plugin.

    Any Suggestions?

    https://ww.wp.xz.cn/plugins/add-meta-tags/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author George Notaras

    (@gnotaras)

    1. Even though I am setting the override Title on each page/post, it is not being used in twitter:title meta tag. Instead the H1 (“title”) of the page/post is being used.

    The custom title only affects the contents of the <title> HTML element. This behavior is by design and there are no plans to change it.

    However you can still change it programmatically. I’m providing the following sample code:

    function custom_title_in_tc_title( $metatags ) {
        if ( is_singular() || amt_is_static_front_page() || amt_is_static_home() ) {
            $post = get_queried_object();
            $og_final = array();
            foreach ( $metatags as $metatag ) {
                if ( strpos($metatag, 'twitter:title') === false ) {
                    $og_final[] = $metatag;
                } else {
                    $og_final[] = amt_get_post_meta_title( $post->ID );
                }
            }
            return $og_final;
        }
        return $metatags;
    }
    add_filter( 'amt_twitter_cards_metadata_head', 'custom_title_in_tc_title' );

    Please note this code is untested. It might require some adjustments. Please feel free to ask your questions if you need more help.

    Plugin Author George Notaras

    (@gnotaras)

    2. My home page is not generating any twitter:title meta tags.

    This is because it gets the title from the BLog Title you have set in the General Settings and most probably this is empty. Please enter a blog title there and it should work as expected.

    Plugin Author George Notaras

    (@gnotaras)

    Hi George, the answer above 3. is not correct. I had info in the blog title and the blog description in the settings page. However, it did not generate until I fixed the code with the snippet I provided above.

    Plugin Author George Notaras

    (@gnotaras)

    Hello Jeff,

    I investigated this issue. You are right. The problem exists in line 90 in the if clause, which should be like this:

    if ( (! is_singular() && ! amt_is_static_home() && ! amt_is_static_front_page()) || amt_is_default_front_page() || is_category() || is_tag() || is_tax() ) {

    According to my tests, this should work in all cases correctly. If possible, I’d appreciate your feedback if you tried it.

    George

    Plugin Author George Notaras

    (@gnotaras)

    I’ve released 2.8.15 which should fix this issue.

    George

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘@jeffmcneill – support question’ is closed to new replies.