ASC and DESC separately from orderby

I would do something like this: <script type=”text/javascript”> //http://www.netlobo.com/url_query_string_javascript.html function gup( name, default_value ) { name = name.replace(/[\[]/,”\\\[“).replace(/[\]]/,”\\\]”); var regexS = “[\\?&]”+name+”=([^&#]*)”; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return default_value; else return results[1]; } //here you can output default values for sortby and … Read more

view subcategories order by id

If you want to order by id you can replace $subcategories = get_terms( ‘category’ , ‘parent=”.get_query_var(“cat’) ); with $args=array( ‘parent’=>get_query_var(‘cat’), ‘orderby’ => ‘id’, ‘order’ => ‘ASC’, ); $subcategories = get_terms( ‘category’ , $args); You can read more about the available parameters in the Codex here: http://codex.wordpress.org/Function_Reference/get_term

Order by ASC, DESC, Title, Date from URL on custom page template post

When you run an additional query, WordPress isn’t going to automagically parse get vars, that only works for the main query. You have to fetch and add them manually. Also, don’t use query_posts, use WP_Query instead. $args = array( ‘category_name’ => $tutcatname, ‘posts_per_page’ => 25, ); if( isset( $_GET[‘order’] ) ){ $args[‘order’] = $_GET[‘order’]; } … Read more

wp_list_categories() by alphabet? (ex. only category titles that start with “A”) [closed]

wp_list_categories() uses the Walker_Category walker which applies the list_cats filter, so a little PHP and: function alpha_prefix_wpse_210205($cat) { $fl = substr($cat,0,1); $fl = strtoupper($fl); return $fl.’ ‘.$cat; } add_filter(‘list_cats’,’alpha_prefix_wpse_210205′); You will want to apply the filter just before you need it and remove it afterwards. function show_categories_fn(){ add_filter(‘list_cats’,’alpha_prefix_wpse_210205′); $lc = wp_list_categories(“echo=0&title_li”); remove_filter(‘list_cats’,’alpha_prefix_wpse_210205′); return $lc; } … Read more

How to display taxonomy terms the way they are hierarchical

term_group seemed to have never been fully developed together with the alias_of parameter. What the exact indended use is (or was), I cannot say for sure. I would just rather avoid the use of those two parameters. Regarding your issue of creating a hierarchical tree, wp_list_categories() immediately jumps to mind (remember this works for custom … Read more

Stylesheet Enqueue Order and Best Practices

You can simply make your plugin css dependent upon the theme css and the child theme css dependent upon the plugin css. function wpdocs_custom_scripts() { // example theme style wp_enqueue_style( ‘theme-style’, ‘#’ ); // Plugin css wp_enqueue_style( ‘plugin-style’, ‘#’, array( ‘theme-style’ ) ); // see “theme-style” passed in $deps param, // Child theme css wp_enqueue_style( … Read more

Ordering posts by title containing numbers

What you’re asking is a generic (My)SQL question, but anyway, as I already said in my comment, if the post title is always in the form of TM.74.G.<number> like TM.74.G.358 and TM.74.G.1000, then you can use the SUBSTRING() function in MySQL/MariaDB to firstly extract the <number> value (e.g. 358) and then sort the posts by … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)