Bestsellers Woocommerce product loop

Wondering how you can make an loop with only the bestsellers of your products for you Woocommerce website? It’s pretty simple! Just make a normal loop and make use of the pre-defined meta-key “total_sales” an order by the value. The code <?php $args = array( 'post_type' => 'product', 'posts_per_page' => 4, 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num', ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) : $loop->the_post(); woocommerce_get_template_part( 'content', 'product' ); endwhile; } else { echo __( 'No products found' ); } wp_reset_postdata(); ?

Display comments on Custom Post Type page by Genesis Framework

So i’m building an custom plugin for one of my clients. I’m using an Custom Post Type, an visitors must be capable to add comments. Normally you will use this function : comments_template();. But because this theme is build with the Genesis Framework it doesn’t work. But to you to save a search this is the function you need to get it done! genesis_get_comments_template(); So spread the Word and share!

WP DEV: Complex custom unique post numbers meta fields

Maybe you know that i’m building an nice premium WordPress plugin for creating invoices, and clients can see there invoices all together. But i needed to make an unique custom post numbers in the meta fields. A number that count 1 number higher than the invoice before. So when i found this WordPress StackExchange post i thought that’s some code i need! So with an little customization i could use it.

WP DEV: Custom post type admin column ordering

Maybe you’re developing an WordPress plugin or theme and you need to change the ordering of the admin columns of you custom post type. I Thought it was very difficult, but actually it isn’t. So that’s why i wanna share with you the simple code snippet! Order the admin columns of your custom post type [code type=”php”] // Reorder your post type columns add_filter( ‘manage_{custom-post-type}_posts_columns’, ‘modify_post_table’ ); function modify_post_table( $column ) {

WP DEV: add_menu_page redirect external url with wp_redirect

Since i’m busy with the development of an new WordPress plugin, i was searching for a function that could redirect the add_menu_page to an external url. I needed this because i wanted to easily redirect an user to an special page. So after some searching it finaly works, and this is the code i love to share with you! Hope you need this or can use this. add_menu_page redirect to external url [code type=”php”]
1 of 4 Next Page