Support » Plugin: Smash Balloon Social Photo Feed » Duplicate Queries

  • Resolved wagedu

    (@wagedu)


    Hi, and thanks for a great plugin πŸ™‚

    I’m debugging a client’s site and Query Monitor (great plugin also) shows your plugin as running duplicate queries.
    The Caller/ “Potential troublemakers” are
    SB_Instagram_Posts_Manager->does_resizing_tables_exist()
    SB_Instagram_Feed::get_resized_images_source_set()
    Just so you know

    Another question would be how to NOT get the alt info for the images, since that alt doesn’t appear anyhow on rollover. I mean, I see all the “alt” text in my page’s source code but, at the same time, Alt on rollover displays nothing.
    I’d prefer to disable it altogether, if you could show me how. But if it’s not possible, I’d like at least to know why ir doesn’t work.

    Thanks in advance and, as I said, great plugin!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Hey wagedu,

    Glad you like the plugin!

    We will fix the duplicate query in the next update.

    For the alt text, we have a hook to create custom alt tags:

    /**
     * Text that appears in the "alt" attribute for this image
     *
     * @param string $img_alt full caption for post
     * @param array $post api data for the post
     *
     * @since 2.1.5
     */
    $img_alt = SB_Instagram_Parse::get_caption( $post, sprintf( __( 'Instagram post %s', 'instagram-feed' ), $post_id ) );
    $img_alt = apply_filters( 'sbi_img_alt', $img_alt, $post );

    Is this helpful for what you?

    Thanks,

    Craig

    Thread Starter wagedu

    (@wagedu)

    Hi @craig-at-smash-balloon thanks for the reply.
    Glad I could help πŸ™‚

    Regarding your hook… I don’t really get it… How am I supposed to REMOVE the “alt” from the images retrieved by the plugin?

    Let me repeat: other than that, mate, that’s some great plugin!

    Plugin Author Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Glad you like the plugin!

    I guess maybe I should ask why you want to remove the “alt” text? Is it causing a specific problem? That might change what I recommend.

    Are you just hoping to have the alt show up on hover? You could add this to the “Custom JavaScript” area on the “Customize” tab to do so:

    jQuery('.sbi_photo').each(function() {
        var title = jQuery(this).find('img').attr('alt');
        jQuery(this).attr('title',title);
    });
    Thread Starter wagedu

    (@wagedu)

    Hi @craig-at-smash-balloon, why wouldn’t I? πŸ˜‰

    Sorry, I think I really made a mess of an explanation. Please let me try again πŸ™‚

    What happened was: I was checking the generated code from our pages and found that the images brought from your plugin all had “Alt” text (the full text of the Instagram post).
    But we’re not using the alt texts.
    We could MAYBE have a “title” but it’s not important for us. And a “title” wouldn’t be the full text of the post, of course.
    So, I thought, if all that text isn’t used, would it be possible to get rid of it?

    Also, anyone using the EWWW plugin (or many other image optimisation pugins) will get those “Alts” duplicated. Twice the weight for something that’s not used. Just as a note πŸ™‚

    Thanks again

    Plugin Author Craig at Smash Balloon

    (@craig-at-smash-balloon)

    Ahh OK. I think I understand now.

    To make the alt tag blank, add this PHP snippet to your theme’s functions.php file:

    function sb_custom_change_alt( $img_alt ) {
    	return '';
    }
    add_filter( 'sbi_img_alt', 'sb_custom_change_alt', 10, 1 );

    If you wanted to fully remove the actual attribute in the HTML, you would need to customize the Instagram Feed item HTML template. We have these instructions:

    https://smashballoon.com/guide-to-creating-custom-templates/

    Hopefully that helps!

    – Craig

    Thread Starter wagedu

    (@wagedu)

    @craig-at-smash-balloon That was awesome!
    Thanks a lot for the help, cheers!

    Plugin Author Craig at Smash Balloon

    (@craig-at-smash-balloon)

    No problem! Happy to help.

    Have a great start to your week.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Duplicate Queries’ is closed to new replies.