Saturday, May 11, 2013

[Help Wordpress] 3 or more Custom Query sliders


Hi Dimitri,


I want to have several different sliders in my pages, sorted by date, title,likes,comments,random or some other query


I have this in my functions


add_filter('new_royalslider_posts_slider_query_args', 'newrs_custom_query', 10, 2);
function newrs_custom_query($args) {
// $args is WP_Query arguments object.
// feel free to change them here
$args = array(
    'orderby' => 'views',
'posts_per_page' => 10
);
return $args;
}


add_filter('new_royalslider_posts_slider_query_args', 'newrs_custom_query', 10, 2);
function newrs_custom_query($args) {
// $args is WP_Query arguments object.
// feel free to change them here
$args = array(
    'orderby' => 'likes',
'posts_per_page' => 10
);
return $args;
}


But it seems the last function is overwriting every other slider, how can I target the custom query for each slider, Am I missing something.


I was also wondering what this arguments are "newrs_custom_query', 10, 2);" , the 10 and 2 ?


Thanks
Vidal
from www.gp-live.com



.

help.dimsemenov.com

No comments:

Post a Comment

Search

Other post

Fashion Store WooCommerce WordPress Theme (WooCommerce) - New WordPress themes
h1 a:hover {background-color:#888;color:#fff ! important;} ...
Kraft - Simple Portfolio WordPress Theme (Portfolio) - New WordPress themes
h1 a:hover {background-color:#888;color:#fff ! important;} ...
Fam | A WordPress Theme for Creative Portfolios and Blogs (Portfolio) - New WordPress themes
h1 a:hover {background-color:#888;color:#fff ! important;} ...
Arvo - A Clever & Flexible Multipurpose WordPress Theme (Creative) - New WordPress themes
h1 a:hover {background-color:#888;color:#fff ! important;} ...
Sport Center - Events & Education Wordpress Theme (Education) - New WordPress themes
h1 a:hover {background-color:#888;color:#fff ! important;} ...