$args = array( 'posts_per_page' => - 1, 'meta_key' => 'meta-checkbox', 'orderby' => array( 'meta_value' => 'DESC', 'date' => 'DESC') ); $posts = new WP_Query( $args ); if($posts->have_posts() ){ while( $posts->have_posts() ){ $posts->the_post(); // Set to content template by default $template = 'content'; // Change template to featured when `is_featured` meta has a value if(get_post_meta(get_the_ID(), 'meta-checkbox', 'yes')){ $template = 'featured'; } // Load template part get_template_part( $template, get_post_format() ); } } UPDATE: As suggested, I added where I use the previous post function Previous Post Function … [Read more...] about How to filter get previous post function by meta value DESC and post date DESC?
Update_post_meta add_post_meta
update_post_meta performance in a loop woocommerce
I have a simple question, I am working on the list order screen of woocommerce and want to add some buttons that via ajax will update some data to the database using update_post_meta. The issue is that these buttons are pressed with a frequency more or less 10 times/minute. … [Read more...] about update_post_meta performance in a loop woocommerce
Approve post and send the password
// create an url vor verify link with some variables: key, post id, and email $url = add_query_arg( array( 'email'=>$author->user_email, 'approve'=>$post->ID), site_url() ); $content = '<table class="body_bg" style="max-width: 600px; border-radius: 5px;" role="presentation" border="0" width="100%" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF"> Tu cuenta ha sido activada. Completa tu perfil en: <a href="' . $url . '" target="_blank" class="button">Confirmar</a> </br> Te deseamos un buen día! </td>'; $check = md5( $author->user_email . $post->ID ); update_post_meta( $post->ID, '_approve_key', $check); … [Read more...] about Approve post and send the password
Top Six Best Related Post Plugins for WordPress (2019)
Related content links are an ideal way to encourage visitors to remain on your website. In doing so, this will improve your bounce rate, page views, and time on website statistics — all metrics with a positive influence on your website’s SEO performance. It’s also a fantastic way to inject life into some of your older articles, which have been pushed off your front page and no longer receive the traffic they deserve. … [Read more...] about Top Six Best Related Post Plugins for WordPress (2019)
How to create a meta_query to get all posts with a specific meta data?
$args = array( 'post_type' => 'product', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => 'vendor', 'value' => 'farsi', 'compare' => '=', ), ) ); This doesn't work when topics is a string, it gets me all products, But I need to get all products that have meta data (vendor) farsi. … [Read more...] about How to create a meta_query to get all posts with a specific meta data?