How to search order using database frontend short code WordPress

Use the below code it may help you and sure that your sql query is correct then it will be work properly. function wpb_demo_shortcode() { global $wpdb; $results = $wpdb->get_results( $wpdb->prepare(“SELECT DISTINCT o.order_id, o.`order_item_name`, om.`meta_value` as ‘bcs’, (select pm.`meta_value` from `wp_postmeta` as pm WHERE o.order_item_id = om.order_item_id AND pm.`post_id` = o.order_id AND pm.`meta_key` = ‘2-certificate’) … Read more

How to display 8 posts in four columns and 2 rows on a carousel slide?

Its very difficult to understand from the HTML code example what you are trying to achieve but going by the php you could do the following. <?php $posts = new WP_Query([ ‘post_type’ => ‘services’, ‘posts_per_page’ => -1, ‘order’ => ‘ASC’ ]); if ($posts->have_posts()) : ?> <ul class=”slider-container”> <?php $loop_position = 1; while ($posts->have_posts()) { $posts->the_post(); … Read more

Display Results of SQL Query on WP site

I see the error described above. I am assuming I need to do a foreach or while command – but all attempts to use these have not yielded results. Yes, shortcodes return strings, not arrays/lists. You need to convert your array/list into a single string. However, get_var assumes a single result. If you want multiple … Read more