I need to create perform for evaluate customized subject values of CPT Posts with default posts CF Worth. As of now I applied under code in template file which is working high-quality, however I need to create perform for identical job. Perform are quick in order that’s why I need to swap.
Anybody has expertise to make issues quicker, solutions are welcomed right here.
<?php
$posts = get_posts(array(
'numberposts' => 1,
'post_type' => array('firm'),
'post_status' => 'publish',
'meta_query' => array(
array(
'relation' => 'OR',
array(
'key' => 'Location',
'worth' => get_post_meta(get_the_ID(), 'Location',true),
'evaluate' => 'IN'
),
array(
'key' => 'Firm',
'worth' => get_post_meta(get_the_ID(), 'Firm',true),
'evaluate' => 'IN'
)),
array(
'relation' => 'OR',
array(
'key' => '_wp_page_template',
'worth' => 'location.php',
'evaluate' => 'IN'
),
array(
'key' => '_wp_page_template',
'worth' => 'firm.php',
'evaluate' => 'IN'
),
) ) ));
if($posts) {
foreach($posts as $submit) {
?>
<a href="<?php the_permalink(); ?>"><?php echo get_post_meta(get_the_ID(),
'Location',true); ?></a>
<?php
} }
else {
?>
<?php
echo get_post_meta(get_the_ID(), 'Firm',true);
}
?>
<?php wp_reset_query(); ?>