• Resolved corentinjr

    (@corentinjr)


    I have to delete the first 3 elements, for this one I have their ID. But the post__not_in in the table does not work

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Michael Nelson

    (@mnelson4)

    Hi @corentinjr, the post__not_in is a WP_Query parameter which can’t be passed into yarpp_related directly. Instead you need to setup a filter to modify the WP_Query YARPP uses under the hood.
    Here’s a forum post that modifies WP_Query based on postmeta: https://wordpress.org/support/topic/related-products-in-stock-or-on-backorder/
    You’ll need to adjust that code to instead set post__not_in.
    Does that help?

    Plugin Author yarpp

    (@jeffparker)

    @corentinjr if you would prefer to exclude posts using no-code, one other way to exclude posts is by tagging them with say “noyarpp” and then excluding them by excluding the “noyarpp” tag under “Disallow by Tags:” under “The Pool” settings.

    Thread Starter corentinjr

    (@corentinjr)

    Super thank you very much for your response

    I find the 2 very interesting and I have a problem for both:

    – With the code: I understood the operation very well, I manage to remove the 3 which bothered me. However, being that the plugin is configured to display “6” posts so I end up with only 3 (since I removed 3 with the code) how can I force the fact to put 9 posts (without modifying the plugin configuration since I use it for other types of content) => maybe post per page?

    – Without the code: For that I understood the operation very well, however my post type is not the default wordpress post but one that I created and therefore the tags of this new post do not appear in plugin settings.

    thank you in advance for your return

    • This reply was modified 4 months, 3 weeks ago by corentinjr.
    Plugin Author yarpp

    (@jeffparker)

    Without the code: For that I understood the operation very well, however my post type is not the default wordpress post but one that I created and therefore the tags of this new post do not appear in plugin settings.

    Quick question – have you enabled YARPP support for the CPT?

    To make YARPP support your Custom Post Type (CPT), the attribute yarpp_support must be set to true when the CPT is registered. The CPT will then be available in the YARPP settings page.

    
    'yarpp_support' => true
    

    For example:

    
    function register_my_cpt() {
      $args = array(
        'public' => true,
        'label'  => 'Books',
        'yarpp_support' => true,
      );
      register_post_type( 'book', $args );
    }
    add_action( 'init', 'register_my_cpt' );

    From FAQs:

    https://wordpress.org/plugins/yet-another-related-posts-plugin/#how%20to%20add%20support%20for%20a%20custom%20post%20type%20%28cpt%29%3F

    Thread Starter corentinjr

    (@corentinjr)

    Super thank you very much for your answers

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.