PHP for Mouseover for Category Icons

From: https://wpgeodirectory.com/support/topic/supreme-directory-category-icons/
PHP

add_filter('sd_details_output_cat_links', 'custom_sd_details_output_cat_links');
function custom_sd_details_output_cat_links($cat_links) {
	global $preview, $post;
	if (!$preview) {
		$post_type = $post->post_type;
		$post_tax = $post_type . "category";
		$post_cats = $post->{$post_tax};
	} else {
		$post_type = $post->listing_type;
		$post_tax = $post_type . "category";
		$post_cats = isset($post->post_category) ? $post->post_category[$post_tax] : $post->{$post_tax};
	}

	if (is_array($post_cats)) {
		$post_cats = implode(',', $post_cats);
	}

	$cats_arr = array_filter(explode(",", $post_cats));
	$cat_icons = geodir_get_term_icon();

	$cat_links = '<div class="sd-detail-cat-links"><ul>';
	foreach ($cats_arr as $cat) {
		$term_arr = get_term($cat, $post_tax);
		$term_icon = isset($cat_icons[$cat]) ? $cat_icons[$cat] : '';
		$term_url = get_term_link(intval($cat), $post_tax);
		$cat_links .=  '<li><a href="' . esc_url($term_url) . '" title="' . esc_attr($term_arr->name) . '"><img src="' . esc_url($term_icon) . '">';
		$cat_links .= '<span class="cat-link">' . esc_attr($term_arr->name) . '</span>';
		$cat_links .= '</a></li>';
	}
	$cat_links .= '</ul></div> <!-- sd-detail-cat-links end --> </div> <!-- sd-detail-info end -->';
	
	return $cat_links;
}

Alter the address at the top of the Supreme Directory detail page

Add this Snippet to add the complete address at the top of the detail page.
Read more here

add_filter('sd_details_output_address', 'modify_sd_details_output_address');
function modify_sd_details_output_address() {
    global $post;
    $sd_address = '<div class="sd-address">';
    if (isset($post->post_address) && $post->post_address) {
        $sd_address .= apply_filters('sd_detail_address', $post->post_address, $post);
    }
    if (isset($post->post_city) && $post->post_city) {
        $sd_address .= '<br/>' . apply_filters('sd_detail_city_name', $post->post_city, $post);
    }
    if (isset($post->post_region) && $post->post_region) {
        $sd_address .= ', ' . apply_filters('sd_detail_region_name', $post->post_region, $post);
    }
    if (isset($post->post_zip) && $post->post_zip) {
        $sd_address .= ', ' . apply_filters('sd_detail_zip', $post->post_zip, $post);
    }
    $sd_address .= '</div>';

    return $sd_address;
}

Add another send enquiry link

Add an additional ‘Send Enquiry’ link that you can style with your own custom CSS
Read more

<?php global $post; if ( ! empty( $post ) && ! empty( $post->geodir_email ) ) { ?>
    <a href="javascript:void(1);" class="b_send_inquiry2" onclick="jQuery('.b_send_inquiry').click();">Send Enquiry</a>
<?php } ?>

Please log in to rate this.
0 people found this helpful.


Category: Supreme Directory Theme

← FAQs