Place not display in GeoDirectory

This topic contains 66 replies, has 6 voices, and was last updated by  Kiran 4 years, 10 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #494133

    rosarnach
    Full Member
    Post count: 71
    This reply has been marked as private.
    #494139

    rosarnach
    Full Member
    Post count: 71
    This reply has been marked as private.
    #494143

    Kiran
    Moderator
    Post count: 7069

    Hello,

    how to display Excerpt text in location page

    Do you want to display excerpt text “of the location page” or “of the listing”?

    Provide listing urls which has description but not showing on frontend.

    Kiran

    #494144

    rosarnach
    Full Member
    Post count: 71
    This reply has been marked as private.
    #494148

    rosarnach
    Full Member
    Post count: 71
    This reply has been marked as private.
    #494151

    rosarnach
    Full Member
    Post count: 71
    This reply has been marked as private.
    #494158

    Kiran
    Moderator
    Post count: 7069

    Hello,

    Use following PHP snippet to display post excerpt when description is empty.

    
    
    /**
     * Show post excerpt when post description is empty.
     */
    function gd_snippet_210619_custom_field_output_post_excerpt( $html, $location, $cf, $output ) {
    	global $gd_post;
    
    	if ( ! empty( $gd_post ) && empty( $gd_post->post_content ) && ! empty( $gd_post->post_excerpt ) ) {
    		$post_excerpt = $gd_post->post_excerpt;
    
    		$extra_fields = ! empty( $cf['extra_fields'] ) ? stripslashes_deep( maybe_unserialize( $cf['extra_fields'] ) ) : NULL;
    		$field_icon = geodir_field_icon_proccess( $cf );
    		$output = geodir_field_output_process( $output );
    
    		if ( strpos( $field_icon, 'http' ) !== false ) {
    			$field_icon_af = '';
    		} elseif ( $field_icon == '' ) {
    			$field_icon_af = '';
    		} else {
    			$field_icon_af = $field_icon;
    			$field_icon = '';
    		}
    
    		$max_height = ! empty( $output['fade'] ) ? absint( $output['fade'] ) . "px" : '';
    		$max_height_style = $max_height ? " style='max-height:$max_height;overflow:hidden;' " : '';
    		
    		$html = '<div class="geodir_post_meta ' . $cf['css_class'] . ' geodir-field-' . $cf['htmlvar_name'] . '" ' . $max_height_style . '>';
    
    		if ( $output == '' || isset( $output['icon'] ) ) $html .= '<span class="geodir_post_meta_icon geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
    		if ( $output == '' || isset( $output['label'] ) ) $html .= trim( $cf['frontend_title'] ) != '' ? '<span class="geodir_post_meta_title" >'.__( $cf['frontend_title'], 'geodirectory') . ': '.'</span>' : '';
    		if ( $output == '' || isset( $output['icon'] ) ) $html .= '</span>';
    
    		if ( $output == '' || isset( $output['value'] ) ) {
    			$content =  wp_strip_all_tags( do_shortcode( wpautop( stripslashes( $post_excerpt ) ) ) );
    
    			if ( $content ) {
    				if ( ! empty( $output['limit'] ) ) {
    					$content = wp_trim_words( $content, absint( $output['limit'] ), '' );
    				}
    				$html .= $content;
    
    				if ( isset( $output['more'] ) ) {
    					$more_text = empty( $output['more'] ) ? __( "Read more...","geodirectory" ) : __( $output['more'], "geodirectory" );
    					$link_class = ! empty( $output['fade'] ) ? 'gd-read-more-fade' : '';
    					$html .= " <a href='" . get_permalink( $gd_post->ID ) . "#" . $cf['htmlvar_name'] . "' class='gd-read-more $link_class'>" . esc_attr( $more_text ) . "</a>";
    				}
    			}
    		}
    
    		$html .= '</div>';
    	}
    	return $html;
    }
    add_filter( 'geodir_custom_field_output_textarea_var_post_content', 'gd_snippet_210619_custom_field_output_post_excerpt', 100, 4 );

    Kiran

Viewing 7 posts - 61 through 67 (of 67 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket