Reply To: Executing shortcodes in Advanced Title Field & Advanced Description Field

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Executing shortcodes in Advanced Title Field & Advanced Description Field Reply To: Executing shortcodes in Advanced Title Field & Advanced Description Field

#16414

NaturesLens
Participant

Superb – thanks – that made it a lot easier – my shortcodes can be called as functions as well – so – I came up with this:

add_filter('asp_results', 'asp_add_event_details_to_search_content', 10, 1);

function asp_add_event_details_to_search_content($results)
{
foreach($results as $k => & $r)
{
$append = ”;

if ($r->content_type != “pagepost”) continue;

$cost = tec_cost($r->id);
$location = tec_full_location($r->id);
$duration = tec_formatted_schedule($r->id);

if ($cost !== ”)
{
$append = $append . $cost;

if ($location !== ”)
{
$append = $append . ' – ';
}
}

if ($location !== ”)
{
$append = $append . $location;

if ($duration !== ”)
{
$append = $append . ' – ';
}
}

if ($duration !== ”)
{
$append = $append . $duration;
}

if ($append !== ”)
{
$append = '<div class=”additional_search_meta”>' . $append . '</div>';
}

$r->content = $r->content . $append;
}

return $results;
}

And that results in the results looking like the attached

Attachments:
You must be logged in to view attached files.