Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Justin Sternberg

    (@jtsternberg)

    Since the plugin pulls results from Google Analytics directly and then tries to find a WordPress post to match, there isn’t a traditional loop. You can modify the list item output by doing something like the following:

    function modify_gtc_list_item( $list_item_html, $page, $wppost ) {
    
    	if ( isset( $wppost->ID ) ) {
    
    		$excerpt = isset( $wppost->post_excerpt ) ? wpautop( $wppost->post_excerpt ) : '';
    		$date = sprintf( '<span class="post-date">%s</span>', get_the_time( 'l, F j, Y', $wppost->ID ) );
    
    		$to_add = $date . $excerpt;
    		$list_item_html = str_replace( '</li>', $to_add . '</li>', $list_item_html );
    	}
    
    	return $list_item_html;
    }
    
    add_filter( 'gtc_list_item', 'modify_gtc_list_item', 10, 3 );
    Thread Starter tibewww

    (@tibewww)

    Than you ??

    A last question,

    If i wish to use the same widget in different widget area, each time to display the top post from a different category . . . . How can I achieve that ?

    My back end skills are a bit limited, I Hope you understand,

    THank you for all your time ??

    Plugin Author Justin Sternberg

    (@jtsternberg)

    The widget can be configured separately in each widget area you put it in.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add post excerpt and date?’ is closed to new replies.