• Resolved kkrueger61

    (@kkrueger61)


    We use the plugin successful over a long time and there are no problems to show ordered posts on the main page in the news section (posts) nor on the overview sites with our sectors/departments: https://life-online.de/bildungsangebote/ We have a multisite with the Divi Theme and the sectors site by now uses the portfolio plugin with ordered projects within categories.

    Now we want to use the filterable portfolio https://life-online.de/bereichsseite-bildung-new/ to show the ordered projects by categories but they remain ordered by date although they are the exact same categories and projects as in the portfolioplugin on the bildungsangebote site.

    I turned debuging on and can see that the plugin is working on the bildungsangebote site:

    • RPWC2 SORT VALIDATION, sorting posts in term: 370
      [24-Jan-2023 10:20:03 UTC] DEBUG_MSG:
      + RPWC2 SORT VALIDATION, found post_type ‘project’ / taxonomy ‘project_category'(370)

    but no debuging code for the filterable portfolio site apart from the category for the news at the bottom of the page which works as expected.

    Do you have a hint for me how I can solve the problem?

    Viele Grü?e Katja

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    Now we want to use the filterable portfolio https://life-online.de/bereichsseite-bildung-new/ to show the ordered projects by categories but they remain ordered by date although they are the exact same categories and projects as in the portfolioplugin on the bildungsangebote site.

    are you saying your portofolio post type is being handled by a plugin?

    In this case, likely the plugin is a overriding the query filters used order and rank the results.
    In the file ReOrder-posts-within-categories/includes/class-reorder-post-within-categories.php , lines 202,203, 204, hook the query filters. You could try to change the filter priority from 5/10/10 to 50/100/100 to see if it makes a difference

    Thread Starter kkrueger61

    (@kkrueger61)

    yes, the portfolio is handled by a theme/plugin

    No, I’m sorry I changed the priority but nothing changed, the projects are still orderd by date

    Plugin Author Aurovrata Venet

    (@aurovrata)

    I just released v2.14.0, can you upgrade and run your page in debug mode and past here the results. I have enabled the final SQL query to be printed in debug mode to see what is being pulled from the DB

    Thread Starter kkrueger61

    (@kkrueger61)

    Thanks for your help here is the debug message

    [30-Jan-2023 08:25:58 UTC] DEBUG_MSG:
    [288]./public/class-reorder-post-within-categories-public.php
    + RPWC2 SORT VALIDATION, found post_type 'post' / taxonomy 'category'(379)
    [30-Jan-2023 08:25:58 UTC] DEBUG_MSG:
    + RPWC2 (query filter: posts_where query), sorting posts in term: 379, WHERE AND wp_posts.ID NOT IN (65741) AND (
    wp_term_relationships.term_taxonomy_id IN (473)
    AND
    tt1.term_taxonomy_id IN (379)
    ) AND wp_posts.post_type = 'post' AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'inherit') OR (wp_posts.post_status = 'private')) AND rankpm.meta_value=379 AND rankpm.meta_key='_rpwc2'
    [30-Jan-2023 08:25:58 UTC] DEBUG_MSG:
    + RPWC2 (query filter: posts_join query), LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id) LEFT JOIN wp_postmeta AS rankpm ON wp_posts.ID = rankpm.post_id
    [30-Jan-2023 08:25:58 UTC] DEBUG_MSG:
    + RPWC2 (query filter: posts_orderby query) ORDER BY rankpm.meta_id ASC
    [30-Jan-2023 08:25:58 UTC] DEBUG_MSG:
    + PWC2 (query filter: posts_request), final SQL query:
    SELECT SQL_CALC_FOUND_ROWS wp_posts.*
    FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id) LEFT JOIN wp_postmeta AS rankpm ON wp_posts.ID = rankpm.post_id
    WHERE 1=1 AND wp_posts.ID NOT IN (65741) AND (
    wp_term_relationships.term_taxonomy_id IN (473)
    AND
    tt1.term_taxonomy_id IN (379)
    ) AND wp_posts.post_type = 'post' AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'inherit') OR (wp_posts.post_status = 'private')) AND rankpm.meta_value=379 AND rankpm.meta_key='_rpwc2'
    GROUP BY wp_posts.ID
    ORDER BY rankpm.meta_id ASC
    LIMIT 0, 2

    Plugin Author Aurovrata Venet

    (@aurovrata)

    The plugin is working fine, your final query is,

    SELECT SQL_CALC_FOUND_ROWS wp_posts.*
    FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id) LEFT JOIN wp_postmeta AS rankpm ON wp_posts.ID = rankpm.post_id
    WHERE 1=1 AND wp_posts.ID NOT IN (65741) AND (
    wp_term_relationships.term_taxonomy_id IN (473)
    AND
    tt1.term_taxonomy_id IN (379)
    ) AND wp_posts.post_type = 'post' AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'inherit') OR (wp_posts.post_status = 'private')) AND rankpm.meta_value=379 AND rankpm.meta_key='_rpwc2'
    GROUP BY wp_posts.ID
    ORDER BY rankpm.meta_id ASC
    LIMIT 0, 2

    which you can run in a separate SQL tool such as PhpMyAdmin to see that it retrieves your posts.

    However, this query imposes 2 additional constraints,
    WHERE AND wp_posts.ID NOT IN (65741) which will exclude this post and (possibly a sticky post or some other filter imposed by your plugin), as well as LIMIT 0, 2 which limits the results to 2 posts only.

    Both of these constraints are set by some other plugin or your theme, so you’ll need to figure out why your query isn’t retrieving all your ranked posts. One way round this is to build your own custom query.

    Thread Starter kkrueger61

    (@kkrueger61)

    Hi,

    I had a look at the id’s and the id 379 is the category “news”. In my first post I wrote “there are no problems to show ordered posts … on the overview sites with our sectors/departments: https://life-online.de/bildungsangebote/” The news section was on the website at the bottom and the whole sql query is about that section and yes it should show only 2 posts.

    I deleted the complete news-section and when I now turn on the debugging code there is absolutly no entry from your plugin.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    I deleted the complete news-section and when I now turn on the debugging code there is absolutly no entry from your plugin.

    then the query is suppressing filters (suppress_filters is set to true by default) and the plugin is not able to rank your results.

    You’ll need to use a custom query instead.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Marking this as resolved.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘posts/projects not sorted in Divi filterable portfolio’ is closed to new replies.