Create a list of posts with topic headdings

OK I got it working. Not sure if it is the best way but I thought I would add a reply anyway. Set up the information needed for the custom loop using $args = array As described in http://codex.wordpress.org/Class_Reference/WP_Query $args = array( ‘post_type’ => ‘product’, ‘meta_key’ => ‘wpcf-topic’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘posts_per_page’ … Read more

Where is the order of a menu saved in the database

You will get the nav_menu_items from wp_term_relationship in correct order. if you want to confirm there order by knowing there order number… u will get the object id of each item from the previous table and search for that id in wp_posts. then there will be column for that particular row named menu_order. so that … Read more

Orderby doesn’t work like expected on custom query

First of all, never ever use query_posts. It breaks the main function and all plugins and functions relying on the main query object. For custom queries, use WP_Query or get_posts if aren’t looking to paginate the query As for the following line ‘orderby’ => ‘rr_recommends_count’, I can tell you that rr_recommends_count is an invalid value … Read more

How to check if a product is purchased within the last 365 days before displaying something

This is not that complicated, here is a code snippet that will get you started: if(is_user_logged_in()) { //We only need these products to check $products_to_check = array(81,82,83,84); $customer_bought = array(); //Get all orders made by the current user in the last 365 days $customer_orders = get_posts( apply_filters( ‘woocommerce_my_account_my_orders_query’, array( ‘numberposts’ => $order_count, ‘meta_key’ => ‘_customer_user’, … Read more

Featured-Content/Featured Posts With Random Order

Third party themes are off topic, but I ended up checking it anyway: The Problem What comes before & after your posted code is important: Before: // Return array of cached results if they exist. $featured_ids = get_transient( ‘featured_content_ids’ ); if ( ! empty( $featured_ids ) ) { return array_map( ‘absint’, (array) $featured_ids ); } … Read more

Weekdays as terms – How to order taxonomy terms by ID in admin panel?

Method #1 – Modifying the query arguments If we want to modify the term order for the schedule_day_taxonomy term checklist, on the single schedule cpt edit screen, then we can use the following setup: add_action( ‘load-post.php’, function() { add_filter( ‘wp_terms_checklist_args’, ‘wpse_terms_checklist_args’ ); } ); function wpse_terms_checklist_args( $args ) { // Target the ‘schedule’ custom post … Read more

Advanced WP_Query with meta_query, orderby?

You should really read the documentation on meta_query‘s Here is what is allowed in a meta_query key (string) – Custom field key. value (string|array) – Custom field value. It can be an array only when compare is ‘IN’, ‘NOT IN’, ‘BETWEEN’, or ‘NOT BETWEEN’. You don’t have to specify a value when using the ‘EXISTS’ … Read more

ORDER BY custom field value out of where clause

Define that a population has to be set, and make a list of allowed states as an array. Afterwards, take population into the orderby and sort it DESC. $q = new WP_Query( array( ‘meta_query’ => array( ‘relation’ => ‘AND’, ‘state_clause’ => array( ‘key’ => ‘state’, ‘value’ => array( ‘Wisconsin’, ‘California’ ), //allowed values ‘compare’ => … Read more

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