Home › Forums › Jevelin Theme › Related items in portfolio item
Home › Forums › Jevelin Theme › Related items in portfolio item
Hi I would like the related items to ACTUALLY be related and not just random items… How can I make all related items be from the same category of the portfolio item that is viewed?
Thanks,
David.
Hi David,
I hope you are well today and thank you for your question.
To achieve this you have to overwrite following theme file in Jevelin child theme and change the code on line number 491
/jevelin/framework-customizations/extensions/portfolio/views/single.php
Best regards,
Shufflehound team
Hi
I tried editing, I added this to get the post id’s from the current category:
$taxcategory = get_the_category();
$idcategory = $taxcategory[0]->cat_ID;
$post_ids_related = get_posts(array(
'numberposts' => -1, // get all posts.
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => $idcategory,
),
),
'fields' => 'ids', // Only get post IDs
));
And then changed the following to:
$portfolio_items = new WP_Query(array(
'post_type' => 'fw-portfolio',
'posts_per_page' => 4,
'orderby' => 'rand',
'post_status' => 'publish',
'post__in' => $post_ids_related
));
but it doesn’t seem to work… Help?
Instead of get_the_category you have to use get_the_terms function and also use post_type argument in both the queries.
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
Could you elaborate further by what you mean by both queries? We are trying to use this too
If you need services beyond standard support, we've got your back!
If you'd prefer not to handle the installation yourself or need help getting started, we'll set everything up for you.
We'll help you rearrange sections, adjust spacing, and modify the page structure to fit your needs.
More complex styling changes, theme option modifications, and third-party integrations.
If you need something that's not included in the theme, we can code it for you.
Web design services to create custom sections, pages, and blocks for your theme, plus graphics and visualizations.
Full website builds, custom theme development, or plugin creation from scratch.
We'll provide a clear quote based on what you need. No hidden fees.