Solution for this topic
Hey.
Thank you for your response.
Actually, I found a way around this, and I would like to add the solution here in case someone needed to achieve the same function.
1 – First of all, I needed to add an ID for each Item in the filter. And I was able to do this by changing the code in this file
wp-content/themes/jevelin/framework-customizations/ extensions/shortcodes/shortcodes/portfolio/views/ view.php
From this:
<?php foreach( $filter_category as $cat ) : ?> <?php if( in_array( $cat->term_id, $atts_categories ) && in_array( $cat->name, $categories_used ) ) : ?> <span class="sh-filter-item<?php echo ( isset( $cat_slug ) && $cat_slug == $cat->slug ) ? ' active' : ''; ?>" data-filter=".category-<?php echo esc_js( $cat->slug ); ?>" data-href="<?php echo esc_url( get_permalink( $post_id ) ); ?>?category=<?php echo esc_js( $cat->slug ); ?>"> <div class="sh-filter-item-content"><?php echo esc_attr( $cat->name ); ?></div> </span> <?php endif; ?> <?php endforeach; ?>
To this:
<?php $i = 1; foreach( $filter_category as $cat ) : ?> <?php if( in_array( $cat->term_id, $atts_categories ) && in_array( $cat->name, $categories_used ) ) : ?> <span class="sh-filter-item<?php echo ( isset( $cat_slug ) && $cat_slug == $cat->slug ) ? ' active' : ''; ?>" data-filter=".category-<?php echo esc_js( $cat->slug ); ?>" data-href="<?php echo esc_url( get_permalink( $post_id ) ); ?>?category=<?php echo esc_js( $cat->slug ); ?>"> <div id="<?php echo "item{$i}"; ?>" class="sh-filter-item-content"><?php echo esc_attr( $cat->name ); ?></div> </span> <?php endif; ?> <?php $i++; endforeach; ?>
And by that, each item in the filter would have an ID with (item1, item2 ..etc)
2 – After that, I just added this javascript code in the JavaScript custom code section in the theme:
<script> jQuery(function(){ jQuery('#item2').click(); }); </script>
Remember to change the ‘item2’ in the Javascript code above into your item ID number in the filter that you implemented.
Good luck everyone.