get_post orderby not working in plugin

You don’t get any ordering, because you are making multiple get_posts() calls and only retrieve a single post in each of them. You cannot order a single post. 🙂 You need to get rid of outermost loop and just pass a set of IDs (that would be your $instance[‘data’]) to retrieve via single get_posts() call.

Create a regular post for every WooCommerce order

in comments I propose to make the order as public but I found a easier way to display a order : with a shortcode i try this in a plugin : add_shortcode(“view_order”, function ($atts, $content = “”, $tag) { if (!isset($_GET[“order_id”])) { return “no id”; } $order = get_post($_GET[“order_id”]); if ( !isset($order) || (“shop_order” !== … Read more

Order post by taxonomy

It is quite easy to achieve this. Your answer is usort() FEW NOTES: Before we code, just a few notes Requires PHP5.4+ due to the use of the short array syntax ([]). If you have an older version, you should really upgrade as older versions are a real security threat as all older versions prior … Read more

Child pages not affected by orderby

post_parent should be the ID of the post parent, not the slug. Apart from that, your code should work. If not, look for any posts_* filters or pre_get_posts actions that might influence your custom query EDIT Something else I have missed, $args is already an array, so you do not need to add it another … Read more

Get usermeta info from sql query

You can use meta_query to specify what conditions you want to meet with that query you are performing. i.e.: // grab some record from DB with a specific meta query $args = array( ‘post_type’ => array( ‘woo_commerce_something’ ), ‘orderby’ => ‘rand’, ‘posts_per_page’ => -1, ‘meta_query’ => array( array( ‘key’ => ‘meta_something_woo_commerce_email’, ‘value’ => ’email@[email protected]’ ) … 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

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