Option for pages order in backend

In a theme with no menu locations defined – or a WordPress install with no menus set up – the default fallback option for menus is to display the output of wp_page_menu(). By default, this will output all of your pages firstly by their order, then by their title if the orders match. This makes … Read more

WP_Query with multiple orderby NOT working with ASC and DESC, what’s wrong?

Your code is invalid (syntax error, missing closing array and semi-colon), and incorrectly nested – if you were to properly indent your code, you’d have something like: $args = array( ‘tag’ => ‘tag-AAA,tag-BBB’, array ( ‘orderby’ => array( ‘title’ => ‘ASC’, ‘post_date’ => ‘DESC’, ) ), ); See how orderby isn’t actually a property of … Read more

Need to know custom code to display random and most viewed posts in wordpress posts and pages

A standard WordPress install doesn’t keep track of visits to pages/posts. So without a plugin there’s no way to know which posts/pages are visited most often. As to finding random posts that’s as simple as: $args = array( ‘post_type’ => array( ‘post’, ‘page’, ‘my-custom-post-type’ ) ‘orderby’ => ‘rand’, ); $query = new WP_Query ($args);

Order get_terms by multiple meta_values

That is because get_terms() does not accept array type as a value for the ‘orderby’ parameter. The documentation says about this parameter: ‘orderby’ (string) Field(s) to order terms by. Accepts term fields (‘name’, ‘slug’, ‘term_group’, ‘term_id’, ‘id’, ‘description’), ‘count’ for term taxonomy count, ‘include’ to match the ‘order’ of the $include param, ‘meta_value’, ‘meta_value_num’, the … Read more

get_previous_post() while accounting for sticky posts

Ok, this might be overcomplicating things a bit, but at least it should work (untested). Just call the function like so get_adjacent_without_sticky( get_the_ID(), true); // get previous post get_adjacent_without_sticky( get_the_ID(), false); // get next post This could have been solved easily, if get_previous_post() allowed for an ID to pass and not only run it in … Read more

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