[Plugin ACF] Indicate blog posts in search results
-
I’d like to find a way to indicate in search results whether something is a blog post or a page. I’ve tried various solutions from this forum, and nothing’s working.
I use Advanced Custom Fields throughout my site, and those on blog posts are different from those on pages. The simplest way – it seems to me – to indicate something is a blog post is, in search results, to do something like:
<?php while ( have_posts() ) : the_post(); $blog = a_blog_only_acf_field; $themeta = get_post_meta($post->ID, $blog, TRUE); if($themeta != '') { echo 'This is a blog'; }
?>
Am I referencing an ACF field in the wrong way? Or is there an easier way to identify if something is a page or a post?
Thanks!
- The topic ‘[Plugin ACF] Indicate blog posts in search results’ is closed to new replies.