an
groups-icon

Custom post type in search results

Wait a minute... This content is very very old. We no longer sell or support this theme version. New Topics
  • Version 9
    Valrie Clarke
    0 points
    Beginner

    Hi, how you doing?

    I have finally done the upgrade to the latest v6 (was on v5 something previously). But now my custom posts (event) from another plugin aren’t displaying right in search results, it lists the same date for all search result entries. I’ve added a couple of links to show what is happening.

    Search results link: https://www.black-gold.biz/index.php?s=usher+ur+experience

    Here’s a link with correct details:
    https://www.black-gold.biz/whats-on/categories/?country=GB&em_search=usher+ur+experience&pno=1&action=search_events

    The code I was using no-longer displays the correct date or location. Is anyone able to tell me what I need to amend in the below code to get this working again please.

    [code title=””]// INCLUDE EVENTS IN SEARCH RESULTS
    if(!function_exists(‘cw_add_to_default_search’)) {
    function cw_add_to_default_search() {
    global $CORE, $CORE_CART, $PPT, $wpdb;
    //INPUT YOUR CUSTOM POST TYPE HERE
    $new_post_type = ‘event’;
    //ADD TO $GLOBALS[‘post_type’] ARRAY
    if(isset($GLOBALS[‘post_type’]) && is_array($GLOBALS[‘post_type’]) && !in_array(“$new_post_type”,$GLOBALS[‘post_type’])) { $GLOBALS[‘post_type’][] = “$new_post_type”; }
    }}
    add_action( ‘hook_wlt_core_search’, ‘cw_add_to_default_search’ );[/code]

    Thanks in advance
    Val

    November 21, 2014 at 3:51 pm
  • Valrie Clarke
    0 points
    Beginner
    Members Only Content

    This reply is for PremiumPress customers only.

    Login Now
    December 3, 2014 at 3:20 am

304

Views

1

Replies