Hi asknlearn
I hope you meant editing theme files instead of (WordPress or plugin) core files.
Create a child theme if you need to edit theme files. That way the changes are permanent, even if the theme updates.
Do you use the widget or shortode or some other method to display the related posts?
Hi there,
Thank you for the prompt reply!
I edited php files for your plugin
Everywhere it specified 5 posts
I just changed it to 6.
Not quite sure how to accomplish
that with a child theme (tho I have
one for CSS styling.
I currently use the Elementor plugin with a custom query with the following php
add_action(
/* Pre-Elementor 2.5.1 use this:
'elementor_pro/posts/query/lwp_related_posts', */
'elementor/query/lwp_related_posts',
'lwp_3266_related_posts'
);
function lwp_3266_related_posts( $query ) {
global $post;
$query->set(
'post__in',
km_rpbt_get_related_posts(
$post->ID,
array( 'fields' => 'ids' )
)
);
}
This code was supplied by a blogger to get it to work with Elementor. I guess with my minimal knowledge I donβt know how to make it show 6 posts with this code (or if I can do so).
Thank you again for being prompt and attempting to help.
-
This reply was modified 2 years, 11 months ago by
keesiemeijer. Reason: fix code block
Try it with this in your child theme’s functions.php file
add_action(
/* Pre-Elementor 2.5.1 use this:
'elementor_pro/posts/query/lwp_related_posts', */
'elementor/query/lwp_related_posts',
'lwp_3266_related_posts'
);
function lwp_3266_related_posts( $query ) {
global $post;
$query->set(
'post__in',
km_rpbt_get_related_posts(
$post->ID,
array(
'fields' => 'ids',
'posts_per_page' => 6,
)
)
);
}
That did the trick! I think I tried that before but missed the extra β)β
I really appreciate your help!
Extremely kind of you to offer this plugin.
All the best to you, now off to write a 5 star review.
Take care!
I’m glad you’ve got your issue solved π
And thanks for your review