Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1049424

    Hello .. Good night! I have a section on my site where her ID is #blog, there are 3 posts displayed on the homepage. I opened a previous topic here and asked for help so that when I clicked on the “Read more” button of the post, it opened in a new tab. The moderator helped me with the following code:

    function blog_link(){
    ?>
    <script>
    jQuery(window).load(function(){

    jQuery(‘#blog .more-link’).attr(‘target’,’_blank’);
    });
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘blog_link’);

    But now I also wanted that when people clicked on the post image, it would open in a new tab. In both the home page posts and the posts on the “Blog” and “Achievements” page.

    I tried this code, but it did not work:

    function blogimage_link(){
    ?>
    <script>
    jQuery(window).load(function(){
    jQuery(‘#blog .img.wp-post-image’).attr(‘target’,’_blank’);
    });
    </script>
    <?php
    }
    add_action(‘wp_footer’, ‘blogimage_link’);

    My website is http://www.casazero.cz/novosite

    • This topic was modified 5 months, 2 weeks ago by  LuizaCFranco.
    #1049785

    Hey LuizaCFranco,

    Thank you for using Enfold.

    You can use the “slide-image” selector to target the featured image.

    Best regards,
    Ismael

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

You must be logged in to reply to this topic.