Linked Portfolio and Gallery images not in order

I have this site im designing for a client and over the course of the design we have made many changes to the galley and images im using Essential Grid for the gallery and the image is linked to the portfolio item. the issue is - Once your in the gallery and you hit next it goes to the next image in the portfolio but thats not the next image in the collection of that gallery so how can I get this reorganized with out having to redo the whole portfolio its about 50 items. I have 4 galleys on 4 pages. Ill include a link in secure.

Is there a plugin to organize or some code I can place ?

Hello @rotation,

Thanks for writing in!

Can you please share the website URL that I can take a look?

Thanks.

As you can see in the secure not links the photos go to the image but once your viewing that large image and its the portfolio image if you use the arrow in top corner of the image to go to next image it goes to the next portfolio item - I want it to go to the next gallery item in order like the gallery is in order.

Hi @rotation,

That’s not currently possible, the next and previous feature is Wordpress default functionality and it’s used for navigating next or previous items. The gallery collections have no connection to portfolio items, it’s only used to display them.

But, if you mean by collection as portfolio category then it’s possible by adding this code to child theme’s functions.php

  function x_entry_navigation() {

  $stack = x_get_stack();

  if ( $stack == 'ethos' ) {
    $left_icon  = '<i class="x-icon-chevron-left" data-x-icon-s="&#xf053;"></i>';
    $right_icon = '<i class="x-icon-chevron-right" data-x-icon-s="&#xf054;"></i>';
  } else {
    $left_icon  = '<i class="x-icon-arrow-left" data-x-icon-s="&#xf060;"></i>';
    $right_icon = '<i class="x-icon-arrow-right" data-x-icon-s="&#xf061;"></i>';
  }

  $is_ltr    = ! is_rtl();
  $prev_post = get_adjacent_post( true, '', false, 'portfolio-category' );
  $next_post = get_adjacent_post( true, '', true, 'portfolio-category' );
  $prev_icon = ( $is_ltr ) ? $left_icon : $right_icon;
  $next_icon = ( $is_ltr ) ? $right_icon : $left_icon;

  ?>

  <div class="x-nav-articles">

    <?php if ( $prev_post ) : ?>
      <a href="<?php echo get_permalink( $prev_post ); ?>" title="<?php __( 'Previous Post', '__x__' ); ?>" class="prev">
        <?php echo $prev_icon; ?>
      </a>
    <?php endif; ?>

    <?php if ( $next_post ) : ?>
      <a href="<?php echo get_permalink( $next_post ); ?>" title="<?php __( 'Next Post', '__x__' ); ?>" class="next">
        <?php echo $next_icon; ?>
      </a>
    <?php endif; ?>

  </div>

  <?php

  }

It should work if you have no other existing customization related to it. Please note that we don’t maintain and provider support for custom code like this, this should only serve as your starting point and the idea on how to achieve it.

Thanks!

I just figured out that its actually simple no code needed …

All you have to do is change the time that each portfolio item was published at by 1 minute after each other or before each other for each image and match it to the gallery image order and now they will be in the order of the galley and portfolio view

Glad it’s working now and thanks for sharing.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.