Modified order of all sliders list by date

johnmcole's Avatar

johnmcole

09 Apr, 2017 02:05 PM

Hello,

Is it possible to change the order of the sliders on the admin page /wp-admin/admin.php?page=new_royalslider to list by most recent (date)?

Line 177 in /wp-content/plugins/new-royalslider/classes/NewRoyalSliderManage.php:

$sliders = $wpdb->get_results("SELECT * FROM " . $prefix . "new_royalsliders ORDER BY id");

Is there a filter or way of doing this besides changing the plugin code?

Thanks,
John

  1. Support Staff 1 Posted by Dmitry Semenov on 09 Apr, 2017 02:13 PM

    Dmitry Semenov's Avatar

    Hello,

    Unfortunately, there is no filter that would allow this. But I'll consider adding it.

    You may create a JS file in your child theme, include it on slider admin page (or on all admin pages), and reorder table row elements via JS. For now, it's the only way without editing plugin code.

    Also, if you have a lot of sliders that contain just images/text, consider overriding default [gallery] shortcode once. http://help.dimsemenov.com/kb/wordpress-royalslider-tutorials/wp-cr...

  2. 2 Posted by johnmcole on 09 Apr, 2017 02:23 PM

    johnmcole's Avatar

    Ok, thank you for the reply. A filter would be great, but in the meantime I'll look into the JS solution.

  3. 3 Posted by johnmcole on 05 Nov, 2018 07:33 PM

    johnmcole's Avatar

    Hi Dmitry,

    Has there been any movement towards reversing the admin slider list by date or id?

    Best,
    John

  4. 4 Posted by johnmcole on 05 Nov, 2018 07:55 PM

    johnmcole's Avatar

    I think I filter would be the most efficient way to do this, but in the meantime, I've written the following javascript which seems to work (with a long delay due to the large number of rows of sliders):

    function gp_wp_admin_style() {
    if($_GET["page"] == "new_royalslider") { wp_enqueue_script('gp-admin', get_template_directory_uri() . '/js/jquery.admin.js', 'jquery', '1.0', true); } } add_action( 'admin_enqueue_scripts', 'gp_wp_admin_style' );

    Contents of jquery.admin.js:

    $.fn.reverseChildren = function() { return this.each(function(){ var $this = $(this); $this.children().each(function(){ $this.prepend(this) }); }); }; $('#new-royalslider-manage-table tbody').reverseChildren();

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac