Created
March 6, 2017 06:29
-
-
Save kprajapatii/0df26fa31bbfc9e9bb270f147899f583 to your computer and use it in GitHub Desktop.
Show listing description on bubble map
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Show listing description on bubble map ( before custom fields ) | |
function gd_profile_description_on_map_bubble_before( $post_id, $post_info, $post_preview ) { | |
if ( !empty( $post_info->post_id ) ) { | |
global $post; | |
$temp_post = $post; | |
$post = get_post( $post_info->post_id ); | |
$character_count = 50; // limit the character count. | |
if ( !empty( $post ) ) { | |
setup_postdata( $post ); | |
if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { | |
$description = geodir_max_excerpt( $character_count ); | |
} else { | |
$description = get_the_excerpt(); | |
} | |
if ( !empty( $description ) ) { | |
?> | |
<div class="geodir-bubble-meta-profile geodir-entry-content"><p><i class="fa fa-info-circle"></i> <?php echo $description; ?></p></div> | |
<?php | |
} | |
} | |
$post = $temp_post; | |
if ( !empty( $post ) ) { | |
setup_postdata( $post ); | |
} | |
} | |
} | |
add_action( 'geodir_infowindow_meta_before', 'gd_profile_description_on_map_bubble_before', 10, 3 ); | |
// Show listing description on bubble map ( after custom fields ) | |
function gd_profile_description_on_map_bubble_after( $post_info, $post_preview ) { | |
if ( !empty( $post_info->post_id ) ) { | |
global $post; | |
$temp_post = $post; | |
$post = get_post( $post_info->post_id ); | |
$character_count = 50; // limit the character count. | |
if ( !empty( $post ) ) { | |
setup_postdata( $post ); | |
if ( isset( $character_count ) && ( $character_count || $character_count == '0' ) ) { | |
$description = geodir_max_excerpt( $character_count ); | |
} else { | |
$description = get_the_excerpt(); | |
} | |
if ( !empty( $description ) ) { | |
?> | |
<div class="geodir-bubble-meta-profile geodir-entry-content"><p><i class="fa fa-info-circle"></i> <?php echo $description; ?></p></div> | |
<?php | |
} | |
} | |
$post = $temp_post; | |
if ( !empty( $post ) ) { | |
setup_postdata( $post ); | |
} | |
} | |
} | |
add_action( 'geodir_infowindow_meta_after', 'gd_profile_description_on_map_bubble_after', 10, 2 ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment