The following are examples for developers to change the Detail and Author pages of the Supreme Directory child theme. For instructions about how to change styles or add snippets, please see our page on Customizing Your Style. For support with these examples, please contact a developer at the GD Experts Directory.

Add another service link with icon – Instagram example

At the top of the detail page are a collection of icons linked with URLs to the website or Facebook page of the listing.
This snippet will replace that section, and allow you to edit the order of the icons as well as adding a new icon with link. In this example we are adding a custom URL called ‘instagram’. The field’s html name is ‘instagram’ so add a prefix ‘geodir_’. There is also an optional portion at the end to show how to replace an icon with a different font-awesome icon.

function _my_extra_social_details($output){
	global $post;

	if(isset($post->geodir_instagram) && $post->geodir_instagram){

if (strpos($output, 'fa-external-link-square') !== false) {
$output = str_replace('fa-external-link-square"></i></a>','fa-external-link-square"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_instagram) . '"><i class="fa fa-instagram"></i></a>',$output);
}elseif (strpos($output, 'fa-facebook-official') !== false) {
$output = str_replace('fa-external-link-square"></i></a>','fa-facebook-official"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_instagram) . '"><i class="fa fa-instagram"></i></a>',$output);
}elseif (strpos($output, 'fa-twitter-square') !== false) {
$output = str_replace('fa-external-link-square"></i></a>','fa-twitter-square"></i></a><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_instagram) . '"><i class="fa fa-instagram"></i></a>',$output);
$output = str_replace('<div class="sd-contacts">','<div class="sd-contacts"><a rel="nofollow" target="_blank" href="' . esc_url($post->geodir_instagram) . '"><i class="fa fa-instagram"></i></a>',$output);

// replace some icons
$output = str_replace('fa-facebook-official','fa-wordpress',$output);

	return $output;

PHP for Mouseover for Category Icons


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;

Change category icons on the detail page

This is a PHP Snippet customization that allows you to change out the icons on the detail page.

         $terms_icons['946'] = '';
    return $terms_icons;
add_filter( 'geodir_get_term_icons', '_gd_custom_detail_page_category_icon', 10, 2 );

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 } ?>

Hide the entire featured image area

CSS to hide the featured image from the top part of the page.

.sd.single.geodir-page .featured-area{

Change the default featured image shown on new listings with a constant (add to wp-config.php).


Hide the display of the word “Address” and “Phone” in sidebar but leave the icon in place

.geodir-sidebar-wrap .geodir-i-location,
.geodir-sidebar-wrap .geodir-i-contact { display:none; }

Change Category and Tag links to remove the Location Filter

Links for Categories and Tags on the Detail page will include the location of the listing. For example, the “Restaurant” Category at the top of the page will have a link that includes the location of the listing:
Use the following snippet to make the link for Categories and Tags point to the base page like:
The following Snippet will remove the filter that adds the location slugs to the URL on any page including Listing pages.

remove_filter('term_link', 'geodir_get_term_link', 10);

Modify breadcrumbs to point to GD Home instead of WP Front Page

function modify_breadcrumb_first_item($html) {
    return '<a href="' . home_url() . '/directory/">' . __( 'Directory', 'geodirectory' ) . '</a>';
add_filter('geodir_breadcrumb_first_link', 'modify_breadcrumb_first_item');

Move Detail Page Sidebar Widget Area to the Top of the Sidebar

This snippet will move the entire widget area to the top of the sidebar

remove_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_widget_area', 20);
add_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_widget_area', 1);

Display tags on Detail Page


Use this CSS to show the tags

.sd-detail-info .geodir_more_info { clear: both; }

Author Images and Author Page

Changes for the author image

Changes the default image used on the listing detail page and author page.

define('SD_DEFAULT_FEATURED_IMAGE', 'http://your image url here');

Hide the author image everywhere with CSS

.sd .sd-detail-author {display: none;}

Change every author image on the whole site to be the same

.author-avatar img{
.author-avatar {
    background-image: url(&quot;;);
    background-repeat: no-repeat;
    background-size:  cover;

Change the default image by adding a constant to wp-config.php

define('SD_DEFAULT_GRAVATAR_IMAGE', 'http://your image url here');

Change only the default author image by replacing the image file on your server at: supreme-directory/images/gravatar2.png

Buddypress profile image

Display the BuddyPress profile image instead of the member account Gravatar as author image on Detail page
This snippet will switch out the usual display of the author’s gravatar for the image uploaded to the BuddyPress profile. This snippet is specifically for Supreme Directory and will only work with BuddyPress.

function _my_change_sd_avatart_to_bp($html){
    global $post;
    $author_id = $post->post_author;
    $avatarurl = bp_core_fetch_avatar( array( 'item_id' => $author_id, type => 'full', 'html' => true ) );
    if($avatarurl){$html = $avatarurl;}
    return $html;

Change the default author background (featured) image:

define('SD_DEFAULT_FEATURED_IMAGE', 'http://your image url here');

Remove the link on the Author Image to the Author Page

add_filter('geodir_reviewer_content_author_link', '__return_false');

Change the “Contact the Author”link into a “Send Enquiry” link that creates a BuddyPress Private Message.

function bp_custom_get_send_private_message_link($to_id,$subject=false,$message=false) {

	//if user is not logged, do not prepare the link
	if ( !is_user_logged_in() )
	return false;

	$compose_url=bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?';
	$compose_url.=('r=' . bp_core_get_username( $to_id ));

	return wp_nonce_url( $compose_url ) ;
add_filter('b_send_inquiry_url', 'b_send_inquiry_url');
function b_send_inquiry_url() {
    global $post;
	$url = bp_custom_get_send_private_message_link($post->post_author);
	return $url;

My Account Area – Add links

add_action('sd_my_account_logged_in_extras', 'sd_my_account_logged_in_extras');
function sd_my_account_logged_in_extras() {
<ul class="sd-my-account-dd-menu-group sd-my-account-dd-menu-bp-group">
                        <li class="sd-my-account-dd-menu-link">
                            <a href="#">
                                <i class="fa fa-user"></i> Link1
                        <li class="sd-my-account-dd-menu-link">
                            <a href="#">
                                <i class="fa fa-user"></i> Link2

My Account Area – Add favorites and listings inside the My Account area

add_action('sd_my_account_logged_in_extras', 'dt_geodir_dashboard_links_custom');
function dt_geodir_dashboard_links_custom() {
	if (!is_user_logged_in()) {

	$dashboard_link = '';
	$post_types = geodir_get_posttypes('object');

	$user_id = get_current_user_id();
	$author_link = get_author_posts_url($user_id);
	$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);

	$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
	$user_listing = geodir_user_post_listing_count($user_id);
	$my_listings_link = false;

	$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
	$user_favourite = geodir_user_favourite_listing_count($user_id);
	$my_favorites_link = false;

	foreach ($post_types as $key => $postobj) {
		if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
			if (!$my_listings_link) {
				$listing_link = geodir_getlink($author_link, array('stype' => $key), false);

				$dashboard_link .= '<li>';
				$dashboard_link .= '<i class="fa fa-user"></i>';
				$dashboard_link .= '<a href="'.$listing_link.'">';
				$dashboard_link .= __('My Listings', 'gdbuddypress');
				$dashboard_link .= '</a>';
				$dashboard_link .= '</li>';

				$my_listings_link = true;

	foreach ($post_types as $key => $postobj) {
		if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
			if (!$my_favorites_link) {
				$post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);

				$dashboard_link .= '<li>';
				$dashboard_link .= '<i class="fa fa-user"></i>';
				$dashboard_link .= '<a href="'.$post_type_link.'">';
				$dashboard_link .= __('My Favorites', 'gdbuddypress');
				$dashboard_link .= '</a>';
				$dashboard_link .= '</li>';

				$my_favorites_link = true;

	echo $dashboard_link;

Advance Search Filters always open

add_filter('sd_search_shortcode_args', 'modify_sd_search_shortcode_args');
function modify_sd_search_shortcode_args($args) {
      if (geodir_is_page('search')) {
         $args['show_adv_search'] = 'always';
      return $args;

Add a wrapper to OEmbeds to enable responsive video

add_filter( 'embed_oembed_html', 'geodir_oembed_filter', 10, 4 ) ;
function geodir_oembed_filter($html, $url, $attr, $post_ID) {
    $return = '<div class="geodir-video-wrapper">'.$html.'</div>';
    return $return;

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

Category: Supreme Directory Theme

← FAQs