Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #195272

    That’s great working much better now thank you. Just to double check was there a way to enable thumbnail and arrow key navigation?
    Many thanks!

    #195370

    Alexander
    Keymaster

    Hey there,

    I’m sorry, we don’t support the keyboard navigation. It could be possible with custom development, however this would be outside the scope of support we can offer.

    #195412

    Not to worry, cheers for the help!

    #195436

    Zeshan
    Member

    You’re welcome!

    #200070

    Tim
    Participant
    This reply has been marked as private.
    #200414

    Zeshan
    Member

    Hi Tim,

    Instead of the above provided codes, simply insert following code in your child theme’s functions.php file:

    // Liking Portfolio Items to Featured Image URL to Open Them in a Lightbox
    // =============================================================================
    
    add_filter( 'post_type_link', 'x_remap_portfolio_to_page', 10, 4);
    function x_remap_portfolio_to_page($post_link, $post, $leavename, $sample) {
    
      if ( 'x-portfolio' == $post->post_type ) {
        return $image_link = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
      }
    
      return $post_link;
    }
    
    add_action('wp_footer', 'enqueue_lightbox_script');
    function enqueue_lightbox_script() {
      echo '
        <script type="text/javascript" src="' . home_url() . '/wp-content/plugins/x-shortcodes/js/dist/site/vendor-ilightbox.min.js"></script>
        <script>jQuery(document).ready(function($) {
           $(\'.page-template-template-layout-portfolio .entry-featured .entry-thumb\').click(function(e) {
              e.preventDefault();
           });
        });
        jQuery(document).ready(function(){jQuery(".x-portfolio .entry-title a").iLightBox({skin: "light",linkId: "gallery-image",overlay: {opacity: 0.875,blur: true},styles: {prevScale: 0.75,prevOpacity: 0.75,nextScale: 0.75,nextOpacity: 0.75},path: "horizontal",controls: {thumbnail: false}});});
      </script>';
    }
    

    If you have made any changes provided in our earlier responses of this thread, please remove them. The provided code will only open the images inside the lightbox on portfolio page. The portfolio items on your homepage are inserted using recent posts shortcodes. If you wish to make those items open in an lightbox, it will require additional customization to the portfolio items. Unfortunately we cannot assist you with that. You may wish to consult a developer to assist you with this.

    Thank you.

    #200674

    Tim
    Participant

    Hello X,

    This works like a charm! Thanks so much. I’m getting happy working with X!

    #201016

    Christopher
    Moderator

    You’re welcome.

    #206608

    dubliner
    Participant

    Hi,
    I’m implementing the above code (#200414) and I’m wondering if it’s possible to modify it slightly so as to avoid the misleading title “Permalink to: ” on my portfolio thumbnails.

    Would it be also possible to pass the title of the featured image to the lightbox caption?
    Many thanks for any help you can provide.

    #207119

    Rad
    Moderator

    Hi there,

    The change is applied indirectly from the templates. Rather just an enhancement through functions.php. The answer is not possible through that coding.

    It’s possible by custom development, you may consult it to a developer.

    Thanks!

    #207596

    dubliner
    Participant

    Thanks for getting back to me and it’s thanks to your suggestion I managed to get it working.

    #207747

    Zeshan
    Member

    You’re welcome! 🙂

    #233963

    thomasmcalister
    Participant
    This reply has been marked as private.
    #234148

    Thai
    Moderator

    Hi @thomasmcalister,
    Upon checking your website, I can see that the lightbox images work fine on my end.
    Please take a look at the screenshot: http://c2n.me/3eO6Ii6
    Try to clear your browser & plugin cache also.
    Thanks.

    #303498

    gmilne
    Participant
    This reply has been marked as private.