• Resolved asknlearn

    (@asknlearn)


    To start with, thank you to the dev for offering this plugin. I love it!

    I hope you can help me with this. I currently use it in conjunction with the Elementor plugin and would like to show 6 related posts, not the default 5.

    I accomplished this by editing the core php files but as soon as an update was released, it undid these changes.

    Is there a way to accomplish this in a way that will stick even with updates?

    Thanks so much for any help you can provide. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author keesiemeijer

    (@keesiemeijer)

    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?

    Thread Starter asknlearn

    (@asknlearn)

    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 5 years, 7 months ago by keesiemeijer. Reason: fix code block
    Plugin Author keesiemeijer

    (@keesiemeijer)

    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,
                )
            )
        );
    }
    Thread Starter asknlearn

    (@asknlearn)

    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!

    Plugin Author keesiemeijer

    (@keesiemeijer)

    I’m glad you’ve got your issue solved ??

    And thanks for your review

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Increasing displayed posts beyond 5.’ is closed to new replies.