Forums › Forums › Search & Filter Pro › Date not always showing
Tagged: categories, date
- This topic has 15 replies, 2 voices, and was last updated 9 years ago by Ross.
-
Ross Moderator(Private) November 24, 2015 at 1:43 pm #30600
Will be jumping on to this again shortly.
Thanks
Ross Moderator(Private) November 24, 2015 at 4:24 pm #30629Hi Daniele
I’ve no idea what hte issue was, but the code you supplied above worked perfectly.
I just pasted this to the top of
results.php
and it worked!If you wish to do some clever things, like hyperlink the category names or anything like that, then you would need to access the array (“Get an array of filters with values and labels”):
and do some processing yourself.
Thanks
Anonymous(Private) November 24, 2015 at 5:35 pm #30635Hey Ross,
Did you try it on the results.php located in the avada theme folder /search-filter ?
I tried this again with the following two codes;
<?php
//Get an array of objects containing data for the current search/filter
//replace1526
with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(14458)->current_query();
var_dump($sf_current_query->get_array());
?>and
<?php
//Get a single fields values using labels
//replace1526
with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(14458)->current_query();
echo $sf_current_query->get_field_string(“_sft_category”);?>
Neither are able to pull the values I need.
I’d like to turn the Categories In: line to not be bulleted and be on the same line. If I can pull the category then it would be fine.
I tried the above codes at the top of the results.php and neither worked.
Any idea why ?
Anonymous(Private) November 24, 2015 at 5:41 pm #30637Just to be clear. The code below:
<?php
$sf_current_query = $searchandfilter->get(14458)->current_query();
echo $sf_current_query->get_field_string(“_sft_category”);?>
Results: Categories: All Categories
It doesn’t display the category that the post is assigned to when using the code:
Categorized in: <?php the_category(); ?>
Ross Moderator(Private) November 24, 2015 at 10:28 pm #30664This reply has been marked as private. -
AuthorPosts