Support » Plugin: Directorist - Business Directory Plugin » Email in the search results

  • Resolved lucasair

    (@lucasair)


    Hello, I ask for help because I disabled the single Listing page.

    Then I would like all fields to be displayed on the Search Result page.

    Today only appears Name, Address and Phone.

    I would need it to also show email and custom fields.

    Thank you very much

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter lucasair

    (@lucasair)

    Help me!!!

    Hi,
    Put this code in your child theme’s functions.php file. You have to replace ‘field_id’ with your custom field’s id.

    function atbdp_custom_listings_info()
    {
        $email = get_post_meta(get_the_ID(), '_email', true);
        $field1 = get_post_meta(get_the_ID(), '140', true);
        $field2 = get_post_meta(get_the_ID(), 'field_id', true);
        if (!empty($email)):
            echo '<li><p><span class="'. atbdp_icon_type() .'-envelope"></span><a target="_top" href="mailto:'.$email.'">'.$email.'</a></p></li>';
        endif;
        if (!empty($field1)):
            echo '<li><p><span class="'. atbdp_icon_type() .'-info"></span>'.__($field1, 'directorist').'</p></li>';
        endif;
        if (!empty($field2)):
            echo '<li><p><span class="'. atbdp_icon_type() .'-info"></span>'.__($field2, 'directorist').'</p></li>';
        endif;
    }
    add_action('atbdp_listings_after_post_date', 'atbdp_custom_listings_info');
    Thread Starter lucasair

    (@lucasair)

    Perfect, that’s right. Worked, thank you!

    Without wanting to abuse, how do I also appear the description field?

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Email in the search results’ is closed to new replies.