[SmartCrawl Pro] Twitter card feature image has changed.

When I first came to wpmudev, SmartCrawl is what brought me here because of the twitter card control that Social tab in smart crawl gave me. I could tweet and control the image I sent, that has changed now.

  • Adam Czajczyk
    • Support Gorilla

    Hello Greg

    I hope you’re well today!

    Currently you got two twitter cards “markup blocks” in the page source. One – and this one is first in the page source code – comes from the WP Tweets Pro plugin and the second one is from SmartCrawl.

    Twitter won’t parse both blocks so I would suggest disabling Twitter Cards option in WP Tweets Pro plugin first and then the SmartCrawl code would be the only one used. You can then use it the same way you did before and if you use large image (e.g. in post/page “SmartCrawl -> Social” box in “Twitter” section) you’ll get the big image in the card.

    I just tested this on my own test site and if SmartCrawl is the only one adding cards, it does work that way.

    Best regards,

    Adam

  • Greg
    • WPMU DEV Initiate

    I appreciate your checking but WP Tweet Pro actually sends out the larger image. The site you checked is the only site I use WP Tweet Pro on, but I have the same issue on my other sites.

    https://daytradersetups.com does not have WP Tweet Pro but all my cards changes a few months back to the smaller card.

    https://cards-dev.twitter.com/validator

    Test https://daytradersetups.com/tc2000/

    This page actually is NOT even showing the Featured Image set by Smart Crawl

    Thanks

  • Adam Czajczyk
    • Support Gorilla

    Hello Greg

    On the daytradersetups.com/tc2000/ site there’s this code coming from SmartCrawl

    <meta name="twitter:card" content="summary_large_image" />
    <meta name="twitter:site" content="daytradersetups" />
    <meta name="twitter:title" content="$ 25.00 Off 1st Month – TC2000 Award Winning Analysis Software" />
    <meta name="twitter:description" content="TC2000 Charting and Scanning Platform. Awarding Winning Analysis Software. Create custom scans for day trading. Also can be used for Paper Trading Account" />
    <meta name="twitter:image" content="https://daytradersetups.com/wp-content/uploads/2017/02/TC2000off25.png" />

    which sets card to “summary_large_image” (that’s a requirement for big images) and uses a 1280×720 pixels image – which is big enough.

    But there’s also yet another code in page source, a bit lower:

    <meta name="twitter:card" content="summary" /><meta name="twitter:title" content="$ 25.00 Off 1st Month – TC2000 Award Winning Analysis Software" /><meta name="twitter:image" content="https://daytradersetups.com/wp-content/uploads/2017/02/TC2000discountnotlinked.png" /><meta name="twitter:image:alt" content="tc2000 discounts from daytradersetups.com" />

    This one uses “summary” instead of “summary_large_image” and uses much smaller image (that’s the image that shows up in validator also).

    So we are dealing with “doubled” Twitter Card code again where one of them is using small images. With this site, the first one is the one from SmartCrawl, serving proper “card” property and big image and the second one is serving small image and “summary” value for “card” property – which is causing small image (and different than the one set in SmartCrawl) in your shared tweets.

    So, I also checked a different place on “dtsvip” site to make sure about the issue. Let’s take this post then:

    Trade Ideas Current Test Drive

    First, we got card code from WP Tweet Pro, using “summary_large_image” (that’s fine) and an image of 300×266 pixels (the name of the image suggests it’s bigger but it is not). There’s widely populated information that image size and ration for “summary_large_image” should be at least 300x156pixes with ration 2:1 but apparently this is no longer true and the image should be closer to 16:9 ration and much bigger size – preferably above 600 x 335 pixels. Since that’s not an official information (Twitter as far as I can see still didn’t update their docs on this) I can’t give you exact dimensions but those seem “safe to assume”. With smaller ones Twitter may in some cases still “fall back” to small image.

    However, these two card code blocks are again – followed by the same kind of code block as on “daytradersetups.com”:

    <meta name="twitter:card" content="summary"><meta name="twitter:title" content="Trade Ideas Current Test Drive"><meta name="twitter:description" content="Don't miss Trade Ideas Next Test Drive. Click here now and register to be emailed for the Next Test Drive Event https://dtsvip.com/go/trade-ideas-summer-test-drive/ #zap #autotrading #testdrivetradeideas #tradeideas"><meta name="twitter:image" content="https://dtsvip.com/wp-content/uploads/TestDriveaug12300x250.png">

    It’s using the same smaller image and it’s using “summary” as the value of “twitter:card” “content” attribute.

    It seems the that this all comes down to this particular code. I admit I didn’t notice it before, when I posted my previous answer – though still it’s about the multiplied code and what it instructs Twitter to do.

    I tried to find out where this particular code block comes from as I believe this is the culprit but I must say I’m still not sure. I’d assume it might be the theme but I don’t see any options for that so it might as well be one of the plugins. You mentioned that started to happen a few months ago so that’s when something must have changed on the site – either some plugin was added that’s causing this or some update brought new feature (e.g. to the theme).

    If you’re not sure what is adding that code then it might be necessary to run a conflict test: try with Twenty Nineteen theme first to confirm/rule out your current theme and if it’s not that – try disabling plugins one by one until that particular code goes away. Knowing what’s adding that code would help finding out how to fix/remove it (either by us or you would need to contact relevant developers).

    Kind regards,

    Adam

  • Greg
    • WPMU DEV Initiate

    https://dtsvip.com/trade-ideas-current-test-drive/

    this is doing what it is suppose to do with wp tweet pro (this is not my issue)

    My issue is https://daytradersetups.com

    do we know what plugin is sending the below extra code

    But there’s also yet another code in page source, a bit lower:

    <meta name=”twitter:card” content=”summary” /><meta name=”twitter:title” content=”$ 25.00 Off 1st Month – TC2000 Award Winning Analysis Software” /><meta name=”twitter:image” content=”https://daytradersetups.com/wp-content/uploads/2017/02/TC2000discountnotlinked.png” /><meta name=”twitter:image:alt” content=”tc2000 discounts from daytradersetups.com” />

    This one uses “summary” instead of “summary_large_image” and uses much smaller image (that’s the image that shows up in validator also).

    So we are dealing with “doubled” Twitter Card code again where one of them is using small images. With this site, the first one is the one from SmartCrawl, serving proper “card” property and big image and the second one is serving small image and “summary” value for “card” property – which is causing small image (and different than the one set in SmartCrawl) in your shared tweets.

  • Greg
    • WPMU DEV Initiate

    function twitter_card_type( $card_type, $query_type, $object_id )

    {

    return ‘summary_large_image’;

    }

    add_filter(‘twitter_card_type’, ‘twitter_card_type’, 10, 3);

    i found the proper code i believe, but i do NOT know where to put it

  • Greg
    • WPMU DEV Initiate

    i now have the image that was showing on the summary small loading as large image,

    But it is not loading the image i have set on Smart Crawl

    which goes back to original item i mentioned was the main reason i came over to wpmudev was that i could control what image is shown

  • Adam Czajczyk
    • Support Gorilla

    Hello Greg

    Thank you for your responses and I’m sorry for the delay on my end!

    Let’s sum it up:

    1. The additional code that I was asking about is coming from another Twitter plugin

    2. You did find and managed to apply additional code to site that makes that plugin use “summary_large_image” instead of “summary”

    3. That helped a bit as now there is a large image used as it should

    4. You do need this plugin for other reasons than Twitter cards but it does add cards anyway

    5. There’s a different image used than set in SmartCrawl

    Is that right?

    The point is: there are multiple code blocks on site that attempt to do the same – set Twitter card. SmartCrawl still does what it did but these codes override it. This is the core of the issue. You can force other plugin to use “summary_large_image” but that other plugin won’t take image from SmartCrawl settings and if its code is overriding the one added by SmartCrawl – you won’t see SmartCrawl’s set image.

    In other words: a perfect scenario would be if there was only one block of code setting Twitter card. If you like the way this can be controlled with SmartCrawl, that should be only the code coming from SmartCrawl.

    So let’s give it another spin, ok?

    The ultimate goal will be to keep all the features of other plugins that you need but only use HTML markup for Twitter cards that comes from SmartCrawl (so you can control it). So we need to make sure that this Twitter plugin is active and does it work but do not add card markup.

    I checked the plugin and found the way to force it to actually not add the card code to HTML. If you add this code to your site (e.g. to functions.php of your theme) it should do the trick.

    function my_no_twitter_card( $features ) {
    unset($features['cards']);
    return $features;
    }
    add_filter( 'twitter_features', 'my_no_twitter_card', 11, 1);

    Could you please give it a try? Add the code, clear caches and see what happens. If there’s still no large/valid image let me know and we’ll look how to sort out other “duplicated” markup so only SmartCrawl’s one would be left. Once SmartCrawl’s is the only one, you should again have that kind of control over Twitter cards that you used to have with SmartCrawl in the past.

    Kind regards,

    Adam

  • Greg
    • WPMU DEV Initiate

    1-5 RIGHT

    i need that plugin to create a twitter collection on some webpages – i wish it did not look for twitter cards – i did change the php on part of it to go to a large card, but it is NOT my choice of images (which i am setting with Smart Crawl)

    what site did you check the code on?

    the theme of https://dtsvip.com will soon be the theme on all sites

    I currently have the twitter plugin deactivated on that site

    thanks

  • Greg
    • WPMU DEV Initiate

    that worked

    thanks

    i will need to test my wp tweet pro on that site, it must work as well

    But I do not have to have the twitter cards on that site, this is staging for new sites we are building, and you got the fix


    THANKS

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.