how do you put a custom var within the following type of the below
AND $wpdb->postmeta.meta_value = 'email'
I wish to include a var for 'email'
something similar to
AND $wpdb->postmeta.meta_value = $var
anybody understand how to do that is Wordpress. I believe i have to bind?
It is dependent a little on context, but when you really are carrying out a custom query (as, say, a part of a widget) you'd provide it as being a disagreement to WP_Query:
$query = new WP_Query( array( 'meta_value' => 'firstname.lastname@example.org' ) );
Oftentimes this could incorporate a corresponding
meta_key for the reason that argument array.
If you wish to customize the presently running query (say, on the category page, only show posts that match a particular criteria) you'd perform that modification throughout the
pre_get_posts action. Suggested reading through: Andrew Nacin's You Don't Know Query.
I'd done that using custom query wordpress plugin Go here
else custom your query such as this
<?php $args = array('post_type' => 'page','meta_query' => array(array('key' => 'email','value' => 'yes','compare' => '%'))); $var = new WP_Query($args); // The Loop while ( $var->have_posts() ) : $var->the_post(); $P_ID = get_the_ID(); endwhile; // Reset Post Data wp_reset_postdata();
Hope it will help