Home › Forums › Jevelin Theme › How to change default portfolio filter item selected
Home › Forums › Jevelin Theme › How to change default portfolio filter item selected
Hi @abd4syria,
I hope you are well today and thank you for your question.
There isn’t any setting to change it so to change this, you have to develop custom code in the child theme of the Jevelin theme.
Developing custom code for custom functionality is beyond the scope of support that we provide here. Please see https://themeforest.net/item/jevelin-multipurpose-premium-responsive-wordpress-theme/14728833/support
If you are not a developer then you can consider hiring a developer to develop it for you. You can hire a developer from any freelance site. Shufflehound recommends the developer https://www.upwork.com/freelancers/~011652ffec8865c6d5
Best regards,
Shufflehound team
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.
Awesome great to see you got that achieved.
Thanks for helping out here in this forum by sharing the solution.
Your help here is really appreciated.
Have a fantastic day!