Shortcode pagination not advancing
Don’t use a hyphen in the shortcode name. See https://codex.wordpress.org/Shortcode_API#Hyphens .
Don’t use a hyphen in the shortcode name. See https://codex.wordpress.org/Shortcode_API#Hyphens .
add_shortcode( ‘type_portfolio’, function( $atts, $content = null ){ $atts = shortcode_atts( array( ‘column’ => ‘3’, ‘category’ => ‘0’, ‘ppp’ => -1 ), $atts); extract($atts); $args = array( ‘posts_per_page’ => $ppp, ‘post_type’ => ‘fen_portfolio’ ); if( $category > ‘0’ ){ $args[‘tax_query’] = array( array( ‘posts_per_page’ => -1, ‘taxonomy’ => ‘cat_portfolio’, ‘field’ => ‘term_id’, ‘terms’ => $category … Read more
The core version of WordPress (i.e. with no plugins installed) has export functionality built-in. You will find the export feature in the main WordPress admin menu in the Tools section. There are three options available. The first option backs up all content including posts, pages, comments, custom fields, categories and tags. Alternatively, you can choose … Read more
$wpdb->get_results() only returns arrays( associative or numeric) or an object. It does not return a string value. If you want a string value, you need to use $wpdb->get_var() instead
Try This: $args = array( ‘hide_empty’ => false, ‘relation’ => ‘OR’, array( ‘key’ => ‘serial_language’, ‘value’ =>’english’, ‘compare’ => ‘LIKE’ ), array( ‘key’ => ‘serial_language’, ‘value’ =>’arabic’, ‘compare’ => ‘LIKE’ ), ‘taxonomy’ => ‘serial’, ); $terms = get_terms( $args ); hope this will help
As Milo noticed, shortcodes should return content instead of echoing it. So change while($query1->have_posts()) : $query1->the_post(); echo ‘<div class=”menu-thumb”>’; the_post_thumbnail( ); echo ‘</div>’; echo ‘<div class=”menu-title”>’; the_title( ); echo ‘</div>’; echo ‘<div class=”menu-content”>’; the_content( ); echo ‘</div>’; endwhile; to while($query1->have_posts()) : $query1->the_post(); $div = ‘<div class=”menu-thumb”>’; $div .= get_the_post_thumbnail( ); $div .= ‘</div>’; $div .= … Read more
The following function will give you an array with the calculated stock quantity from all product variations for each custom meta field “Brand” value, using WPDB Class (a SQL query): global $wpdb; $results = $wpdb->get_results( ” SELECT pm.meta_value as brand, SUM(pm2.meta_value) as stock FROM {$wpdb->prefix}postmeta pm INNER JOIN {$wpdb->prefix}posts p ON pm.post_id = p.post_parent INNER … Read more
Relationship between post and category is not stored in the posts table. You must extend your query for additional tables. By category id: SELECT YEAR(p.post_date) FROM {$wpdb->posts} p JOIN {$wpdb->term_relationships} tr ON tr.object_id = p.id JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id = tr.term_taxonomy_id WHERE tt.term_id = 4 AND p.post_status=”publish” AND p.post_type=”post” GROUP BY YEAR(p.post_date) DESC Or … Read more
You can instantiate your array before-hand, optionally populate it, and pass it to the add_query_arg() function like so: $url_query_args = array(); if( isset( $search ) ) { $url_query_args[‘search’] = $search; } if( isset( $category ) ) { $url_query_args[‘category’] = $category; } if( isset( $filter ) ) { $url_query_args[‘filter’] = $filter; } esc_url( add_query_arg( $url_query_args, ‘/site’ … Read more
Firtly, in SQL the % symbol is a “wildcard operator”. When used in a LIKE statement, it means “0 or more characters”. So LIKE ‘Hello%’ means any string beginning with Hello, including just Hello. While LIKE ‘%Hello%’ means any string that contains Hello, either at the beginning, middle, or end. $wpdb->prepare() on the other hand … Read more