Forums › Forums › Search & Filter Pro › Custom Fields in Display Results using shrotcode
Tagged: acf, Taxonomies Display
- This topic has 3 replies, 2 voices, and was last updated 9 years, 9 months ago by
Ross.
-
Ross Moderator(Private) October 29, 2015 at 6:16 pm #28561
Hi Phil
Do you mean showing the search data?
Then you might be looking for this:
http://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/
Thanks
Anonymous(Private) October 29, 2015 at 8:48 pm #28577Hi Ross
Thanks for getting back to me. Actually I probably didn’t explain myself very well. All I wanted to do was return the results of some simple custom fields in the search results, which I have managed to do in my own clumsy hacking way, by using the get_field for ACF, which works great for me. But I’m having a strange issue with the search results, the post date, which I think is a standard result you would expect to see from your standard results.php template and which I have left in my ‘updated’ version is not automatically showing up – it’s really strange. If I set the CPT published date to something random like two weeks previous it shows in the results, but if I just create a new CPT it just doesn’t show up at all.
I wonder if you have come across this issue before – I realise I should really start a new thread, and I will if there’s not a straight forward answer.
Anyway this is my code for returning the Custom Fields with the post_date towards the end:
while ($query->have_posts())
{
$query->the_post();?>
<div class=”searchresult”><h2>“><?php the_title(); ?></h2>
<?php $field = get_field(“location”, $post_id, $format_value);
$value = get_field( “company” );if( $value ) {
echo ‘<div class=”resultcompany”>’;
echo ‘<h4 class=”resulttitle”>’ . “company” . ‘: </h3>’;
echo ‘<h4 class=”resultvalue”> ‘ . $value . ‘</h3>’;
echo ‘</div>’;
}$field = get_field(“deadline”, $post_id, $format_value);
$value = get_field( “location” );if( $value ) {
echo ‘<div class=”resultlocation”>’;
echo ‘<h4 class=”resulttitle”>’ . “location” . ‘: </h3>’;
echo ‘<h4 class=”resultvalue”> ‘ . $value . ‘</h3>’;
echo ‘</div>’;
}$field = get_field(“deadline”, $post_id, $format_value);
$value = get_field( “deadline” );if( $value ) {
echo ‘<div class=”resultdeadline”>’;
echo ‘<h4 class=”resulttitle”>’ . “deadline” . ‘: </h3>’;
echo ‘<h4 class=”resultvalue”> ‘ . $value . ‘</h3>’;
echo ‘</div>’;
}
?><p class=”resultpostdate”>Vacancy Posted: <?php the_date(); ?></p>
</div>
<?php
}
?>Thanks in advance Ross!
Ross Moderator(Private) November 3, 2015 at 5:16 pm #28866Hey Philip
Sorry for the delay on this.
Did you manage to get it resolved?
It is quite an odd bug, because the default results.php file includes
the_date()
by default, and I’m sure someone else would have mentioned it by now.I just took a look at your link above, and I do see a date formatted
28/10/2015
but not sure if this is the same date we function we’re talking about.Thanks
-
AuthorPosts