• Resolved maddogprod

    (@maddogprod)


    I’m one of the people who had the problem with the recent update not displaying the icons to reorder. That was fixed in the newest update so the back-end works fine. The problem is the changes don’t display on the front-end…and they used to. It’s using a pretty standard category page and worked for a few years until these recent plugin changes.

    Any help will be appreciated! THANKS

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

Viewing 13 replies - 16 through 28 (of 28 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    this is now fixed in v2.5.1

    Thread Starter maddogprod

    (@maddogprod)

    Good morning!

    I saw that there’s an update but alas, it hasn’t fixed it for me. I updated the plugin, switched it off, rearranged things, switched it on….no change. I also reset the order. Then I deactivated the plugin and activated it again. Still not working for me.

    Is there any troubleshooting I can do that might help you?

    Thanks,
    Perro Loco

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Dang!

    Is there any troubleshooting I can do that might help you?

    yes please.

    It basically boils down to detecting the cpt/taxonomy term combination and filtering the results to return the posts in the right order.

    This takes place in the file

    wp-content/plugins/ReOrder-posts-within-categories/public/class-reorder-post-within-categories-public.php

    on line 216, where the function is_ranked should return a boolean for positive identification.

    Can you enable the following lines in your ./wp-config.php,

    
    define('WP_GURUS_DEBUG', true);
    define('WP_DEBUG', true);
     if ( WP_DEBUG ) {
         define( 'WP_DEBUG_LOG', true );
         define( 'WP_DEBUG_DISPLAY', false );
         @ini_set( 'display_errors', 0 );
         define('AUTOSAVE_INTERVAL', 600 );  //seconds
     }
    

    and uncomment line 225 in the is_ranked function. Then run your query again and see if the following line is printed in your wp-content/debug.log file on your server,

    
    DEBUG_MSG: 
       [225]./public/class-reorder-post-within-categories-public.php
              + <your-taxonomy> term <term id> Array
    (
        [0] => <cpt post type>
    )
    

    if this is not the case, please reach out to me on vrata at syllogic dot in

    thanks

    Thread Starter maddogprod

    (@maddogprod)

    I did this and that line isn’t in the debug.log file. Some other errors are. I’ve sent you an email with the log file.

    Thanks for your help!

    Mad Dog

    Plugin Author Aurovrata Venet

    (@aurovrata)

    that line isn’t in the debug.log file

    actually it is….several times ??

    Your query is attempting to get the ranked posts for the

    taxonomy: pdf_category
    term id: 44

    however, it has multiple post_types, ‘pdf’ and ‘attachment’

    [225]./public/class-reorder-post-within-categories-public.php
    + pdf_category term 44Array
    (
    [0] => attachment
    [1] => pdf
    )

    In your dashboard you would have ranked only 1 of these post_types, so you should really build a query that returns only 1 post_type that matches the posts you have ranked in the dashboard.

    The plugin gets confused with multiple post type queries and will simply ignore them.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Hello PerroLoco!

    in retrospect I realise that your query is fine, but since it is a taxonomy query and the WP qeury object does not include the post type, the plugin inspects your setup to find out which post types are associated with the queried taxonomy.

    It found 2, attachment and pdf, and although your query is only seeking to display the ‘pdf’ post type, the plugin is unable to figure this out.

    In your dashboard your taxonomy is registered with both post types whic is fine, but only the pdf post type is ranked.

    Therefore, I have instroduced a new filter for such cases (and updated the FAQ #10 to explain this case). You can therefore tweak the plugin to get your expected result using the following code in your functions.php

    
    add_filter('reorderpwc_filter_multiple_post_type', 'reorder_pdf_post_type', 10, 4);
    function reorder_pdf_post_type($type, $post_types, $taxonomy, $wp_query){
      /* String $type post type to filter.
      *  String $post_types post types associated with taxonomy.
      *  String $taxonomy being queried.
      *  WP_Query $wp_query query object. */
      if('pdf_category' == $taxonomy && in_array('pdf',$post_types)) $type = 'my-custom-post';
      return $type;
    }
    
    Thread Starter maddogprod

    (@maddogprod)

    I hate to tell you this after all this work you’re doing to help….but that’s not working for me. I added the function and have tried, tested, moved, everything. No change.

    Thread Starter maddogprod

    (@maddogprod)

    I’m emailing you the new debug.log. There are two errors pertaining to the new function (and/or the plugin).

    Plugin Author Aurovrata Venet

    (@aurovrata)

    aplogies, I raelised that I made a small mistake in the above code, it sohuld be:

    
    add_filter('reorderpwc_filter_multiple_post_type', 'reorder_pdf_post_type', 10, 4);
    function reorder_pdf_post_type($type, $post_types, $taxonomy, $wp_query){
      /* String $type post type to filter.
      *  String $post_types post types associated with taxonomy.
      *  String $taxonomy being queried.
      *  WP_Query $wp_query query object. */
      if('pdf_category' == $taxonomy && in_array('pdf',$post_types)) $type = 'pdf';
      return $type;
    }
    

    can you fix the type=’pdf’ and try again

    Thread Starter maddogprod

    (@maddogprod)

    It’s still not working and this is what is going into the debug.log now:

    [09-May-2020 23:26:01 UTC] PHP Notice:  Undefined variable: post_types in /home/mysite/public_html/THAI/wp-content/plugins/reorder-post-within-categories/public/class-reorder-post-within-categories-public.php on line 225
    [09-May-2020 23:26:01 UTC] PHP Warning:  in_array() expects parameter 2 to be array, null given in /home/mysite/public_html/THAI/wp-content/themes/wellness/functions.php on line 1240
    Plugin Author Aurovrata Venet

    (@aurovrata)

    yes, my mistake. just fixed in v2.5.5

    would you try it again?

    Thread Starter maddogprod

    (@maddogprod)

    *DING!*DING!*DING*

    Yay! It’s working. Thanks for all the hard work to get it here and please don’t change anything. LOL

    Thanks again,
    Mad Dog

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Great! Glad it worked.

Viewing 13 replies - 16 through 28 (of 28 total)
  • The topic ‘Reorder not displaying on front end now’ is closed to new replies.