I am fairly new to PHP so this might be a simple fix. I am editing a plugin and trying to modify it to where, based on a set of inputs, I want to output only certain posts whose metadata fits the parameters of the inputs and not show posts whose data does not fit. How would I exclude posts whose data does not fit in the output?
I have already done everything up to this point but am stuck at where if the inputted data does not fit in the post meta data it does not display. I am guessing I would need to use a $_post == null
function and have tried many variations of that, but nothing has worked.
The is the line of code I am stuck on:
<?php if ( $creditscore >= esc_attr($min_credit_score) ) { echo "good";} else { $_Post == null; ;
} ?>
Here is the complete code:
<?php htmlspecialchars($_GET["crd"]);
?>
<?php
$args = array(
'post_type' => 'lenders',
'posts_per_page' => $number1,
'lender_cat' => 'personal-loans',
);
$wp_query = new WP_Query($args);
while($wp_query->have_posts()) : $wp_query->the_post();
$advertised_title = get_post_meta(get_the_ID(),'_cmb_advertised_title', true);
$advertised_number = get_post_meta(get_the_ID(),'_cmb_advertised_number', true);
$comparison_title = get_post_meta(get_the_ID(),'_cmb_comparison_title', true);
$comparison_number = get_post_meta(get_the_ID(),'_cmb_comparison_number', true);
$min_credit_score = get_post_meta(get_the_ID(),'_cmb_min_credit_score', true);
$btn_text = get_post_meta(get_the_ID(),'_cmb_btn_text', true);
$btn_link = get_post_meta(get_the_ID(),'_cmb_btn_link', true);
$except = get_post_meta(get_the_ID(),'_cmb_except', true);
$creditscore = htmlspecialchars($_GET["crd"], true);
?>
<?php if ( $creditscore >= esc_attr($min_credit_score) ) { echo "goodtest";} else { wp_query == null; ;
} ?>