feature image class

Home Forums Jevelin Theme feature image class

Home Forums Jevelin Theme feature image class

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
  • SaveATrain
    Participant

    hi, i want to add to every blog post feature image a specific type name

     

    similar to this

    <img src="example.jpg" class=”skip-lazy” />

     

    how can i do that please?

    Hi @SaveATrain,

     

    I hope you are well today and thank you for your question.

     

    To achieve this, you have to develop custom code in the child theme of the Jevelin theme.

     

    Developing custom code for custom functionality is beyond the scope of support that we provide here. Please see https://themeforest.net/item/jevelin-multipurpose-premium-responsive-wordpress-theme/14728833/support

     

    If you are not a developer then you can consider hiring a developer to develop it for you. You can hire a developer from any freelance site. Shufflehound recommends the developer https://www.upwork.com/freelancers/~011652ffec8865c6d5

     

    Best regards,
    Shufflehound team

    SaveATrain
    Participant

    I am a developer,

    I just need to know where in your theme files, can i find the file that is related to the posts

    and then i can find the feature image part, where i can add to it the class that i need inorder for it not to lazy load

    It is the below file.

     

    /jevelin/single.php

    SaveATrain
    Participant

    just to clarify,

    I am speaking about the type of image that is showing below the word Blog Post in this blog post and others

    https://www.saveatrain.com/blog/best-theme-parks-europe/

     

    additionally, if the above is right, i should edit is this:

    <div class=”sh-gallery-item”>
    ” alt=”” class=”width-full” />
    </div>

     

    Yes, it is a single post page that calls a single.php file.

    SaveATrain
    Participant

    i think you misunderstand me.

     

    i added here screenshot of the image i would like to add a class to it.

     

    now i did inspect on the image in chrome and got this:

    img width=”640″ height=”675″ src=”https://saveatrain-12e85.kxcdn.com/blog/wp-content/uploads/2020/12/renata-kiss-q8NhIZ8iKQ-unsplash-640×675.jpg&#8221; class=”attachment-jevelin-landscape-large size-jevelin-landscape-large wp-post-image” alt=”woman positing at disneyland paris” loading=”lazy”

     

    and in single.php, i did this:

     

    div class=”sh-gallery-item”
    img src=”<?php echo jevelin_get_small_thumb( $image[‘attachment_id’] ); ?>” alt=”” class=”width-full skip-lazy” /
    </div

     

    and as you can see in the inspect there is no skip-lazy

     

    so that means you told me to edit the wrong place

    • This reply was modified 3 years, 3 months ago by SaveATrain.
    • This reply was modified 3 years, 3 months ago by SaveATrain.
    Attachments:
    You must be logged in to view attached files.

    I didn’t tell you to edit the wrong place but it seems you don’t know how the WordPress template file system works.

     

    The theme single.php file calls other files using the below code.

     

    get_template_part( 'content', 'format-'.get_post_format() );

     

    So you have to change it also in other files as shown in the attached screenshot.

    Attachments:
    You must be logged in to view attached files.

    SaveATrain
    Participant

    so in all these files, where i see IMG tag, i should add the class i want?

    Yes but please note that these files are also called on blog page.

    SaveATrain
    Participant

    but one might think, that you would call the feature image only once,

    and this is the only image i want to add the skip-lazy class to it

    There is a Post Formats feature in WordPress therefore different files are called.

     

     

    SaveATrain
    Participant

    are you able instead to give me a code snipet that i would add that would allow me to avoid the lazy loading of the feature image?

     

    OR, tell me where in your theme settings to set that the feature image will not be lazy loaded?

    You can disable lazy loading as shown in the attached screenshot.

    Attachments:
    You must be logged in to view attached files.

    SaveATrain
    Participant

    the only place i could find IMG tags were content.php and content-gallery

     

    so i added to their IMG CLASS skip-lazy

    as was suggested in this article:

    https://support.shufflehound.com/forums/topic/feature-image-class/

     

    however examining the post page:

    https://www.saveatrain.com/blog/best-theme-parks-europe/

     

    i can still see the feature image in the source code has loading=lazy and i don’t see anywhere in the code a class with skip-lazy

     

    so i must be editing the wrong place, or i need to turn on and off the theme

     

    can you advise please

     

    SaveATrain
    Participant

    here are the files i edited

    Attachments:
    You must be logged in to view attached files.

    SaveATrain
    Participant

    this is the part i need to edit and add class=skip-lazy

     

    woman positing at disneyland paris

    If you don’t know how to edit the theme files or locate a specific code in the theme files then you can consider hiring a developer to develop it for you. You can hire a developer from any freelance site. Shufflehound recommends the developer https://www.upwork.com/freelancers/~011652ffec8865c6d5

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