Project gallery image alt tag & columns number.

Mauer Themes Support Bild Project gallery image alt tag & columns number.

This topic contains 6 replies, has 2 voices, and was last updated by  Paul 1 year, 4 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1477

    DanaVajea
    Participant

    Hello!

    I have purchased this theme and I am very happy with it but I would like to change some small things:

    1. I have noticed that there are not alt tags for the images in projects galleries. What do I need to change to have the alt tags in the source code?
    2. I want to have the images in the projects galleries in one column. I have chosen “1” in the gallery settings but the images are still displayed in 2 columns. Page: http://danabalan.de/proj/adrian/

    Thanks in advance!
    Dana.

    #1478

    DanaVajea
    Participant

    Nothing..?
    Any help would be apreciated…
    Thanks.

    #1479

    Paul
    Keymaster

    Hello Dana,

    Please excuse me for late reply. I’ll have a chance to get back to you with replies to both questions tomorrow.

    Regards,
    Paul

    #1480

    Paul
    Keymaster

    Hello Dana,

    You can make alt tags be displayed in project galleries by doing the following:

    Go to your functions.php file (located in theme folder), find the following line (should be around line 513)

    $output .= "<img src='" . esc_url($img_reg[0]) . "' itemprop='thumbnail' />";

    and replace it with the following line:

    $output .= "<img src='" . esc_url($img_reg[0]) . "' itemprop='thumbnail' alt='" . get_post_meta( $id, '_wp_attachment_image_alt', true) . "' />";

    Now you will have the text from the ‘Alt Tag’ field displayed in project gallery images markup.

    Regards,
    Paul

    • This reply was modified 1 year, 4 months ago by  Paul.
    #1483

    Paul
    Keymaster

    As for your second request,

    By default the theme places the images in rows of 1 or 2 based on its special algorithm (basically similar to the one that Facebook uses to automatically collage images). And the WP’s native column settings are overridden.

    If I understand you right, the following solution should work fine to achieve what you want. This will make it so that all your pictures added to a gallery within a project will be listed one beneath the other, without occasionally being organized in 2 columns by the theme.

    Here is what you need to do to achieve that.


    A little disclaimer: It’s best to do such modifications in a child theme, so they do not get overwritten during theme updates. However, of course you can always re-introduce them after a theme update.

    1.
    Go to your functions.php file (located in theme folder) and replace the following three lines:

    Should be around line 186, replace

    add_image_size("mauer_thumb_7", 1320, 982, TRUE); // PhotoSwipe gallery big thumb
    with (if you want wider thumbs as in the demo):
    add_image_size("mauer_thumb_7", 1320, 99999, FALSE); // PhotoSwipe gallery big thumb
    or with (if you want thumbs the width of the text column):
    add_image_size("mauer_thumb_7", 850, 99999, FALSE); // PhotoSwipe gallery big thumb

    Should be around line 489, replace
    $class= "mauer-pswp-gallery-img-" . $i . "-of-" . $images_in_block;
    with
    $class= "mauer-pswp-gallery-img-1-of-1";

    Should be around line 504, replace
    $reg_thumb_size = 'mauer_thumb_8';
    with
    $reg_thumb_size = 'mauer_thumb_7';

    2 (Optional).
    Then if you want the thumbnails to be the width of the text column, go to js/general.js in your theme folder and replace (around line 299)
    function adjustPSWPWidth() {
    with
    function adjustPSWPWidth() { return;

    3.
    Finally install and activate this plugin, go to “Tools” > “Regen. Thumbnails” and regenerate the thumbnails.

    Regards,
    Paul

    #1491

    DanaVajea
    Participant

    Magnificent!!! 🙂

    Thanks so much, Paul!!

    Regards,
    Dana

    #1492

    Paul
    Keymaster

    Dana,

    You are very welcome!
    Thank you for using Bild for your website.

    If you enjoy the theme (or support), I would be really grateful if you could rate it on ThemeForest. This literally takes a moment, and actually makes a big difference. Thank you.

    Regards,
    Paul.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.