Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1067471
    hipbluesofa
    Participant

    Hi everyone. Hoping you can help. I have promos on a home page I am creating. I would like to be able to click on the PROMO image and have it link it to a page as well as the link part of the Promo element.

    Website: http://98sports.com.routing.yourhost.co/

    Is this possible?

    thanks.

    #1067932
    Lely
    Moderator

    Hi There,

    Thanks for posting in and giving us your site URL.
    Please add class img-promo-link on your promo element class field where you want this link to apply.
    Then add the following code on your Appearance > Customize > Custom > Edit Global Javascript:

    jQuery ( function( $ ) {
    
    $('.img-promo-link .x-promo-content a').each( function() {
      
      
    $(this).parent().siblings('.x-promo-image-wrap').find('img').wrap( '<a href="' + $( this ).attr('href') + '"></a>' );
    
    } );
    
     } );

    Just add the class img-promo-link every time you want this code to work. So what happens is the code look for the promo element with class img-promo-link. Then it gets the link value you have added on the textfield part of the element and then add it on the image. Just make sure that you only have one link on the text field.

    Hope this helps.

    #1068000
    hipbluesofa
    Participant

    I tried it, doesn’t seem to affect anything.

    #1068020
    Rupok
    Member

    Hi there,

    The above code should work if you add them correctly. Make sure to do the steps correctly. You need to add the class first. Please spend a few more minutes and follow carefully.

    If you think you did it correctly but still not working, provide your login credentials in a private reply.

    Cheers!

    #1068187
    hipbluesofa
    Participant
    This reply has been marked as private.
    #1068288
    Lely
    Moderator

    Hi There,

    Thank you for the credentials. I can see a console error on your page. This might prevent above code from working.

    98sports.com.routing.yourhost.co/:446 Uncaught SyntaxError: Unexpected token }

    Please go to Appearance > Customize > Layout and Design > Select Image for both Background Image and Background Pattern and then save. Then remove those images again. It will reset those settings that was causing the error.

    Hope this helps.

    #1068300
    hipbluesofa
    Participant

    Did that, no success. 🙁

    #1068324
    Paul R
    Moderator

    Hi,

    Thank you for providing your login credentials.

    You can try this code instead.

    
    jQuery ( function( $ ) {
    
    $('.img-promo-link .x-promo-content a').each( function() {
      
      
    $(this).parents().eq(2).find('img').wrap( '<a href="' + $( this ).attr('href') + '"></a>' );
    
    } );
    
     } );
    

    Hope that helps.

  • <script> jQuery(function($){ $("#no-reply-1067471 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>