WordPress.org

Forums

My Plugin Code Show incorrect get_the_time (1 post)

  1. atilazz
    Member
    Posted 2 years ago #

    hello
    i create a widget thats show papular and recent post but thats show all of the time 2013 08 02 whats problem?

    function posts($sort = 'recent', $items = 3, $echo = TRUE, $bg_color = 'black')
    {
    	$return_html = '';
    
    	if($sort == 'recent')
    	{
    		$posts = get_posts('numberposts='.$items.'&order=DESC&orderby=date&post_type=post&post_status=publish');
    		$title = __('Recent Posts', THEMEDOMAIN);
    	}
    	else
    	{
    		global $wpdb;
    
    		$query = "SELECT ID, post_title, post_content FROM {$wpdb->prefix}posts WHERE post_type = 'post' AND post_status= 'publish' ORDER BY comment_count DESC LIMIT 0,".$items;
    		$posts = $wpdb->get_results($query);
    		$title = 'Popular Posts';
    	}
    
    	if(!empty($posts))
    	{
    
    		$return_html.= '<h2 class="widgettitle">'.$title.'</h2>';
    		$return_html.= '<ul class="posts blog '.$bg_color.'_wrapper">';
    
    		$count_post = count($posts);
    
    			foreach($posts as $post)
    			{
    				$image_thumb = get_post_meta($post->ID, 'blog_thumb_image_url', true);
    				$return_html.= '
    <li>';
    
    				if(has_post_thumbnail($post->ID, 'large'))
    				{
    					$image_id = get_post_thumbnail_id($post->ID);
    					$image_url = wp_get_attachment_image_src($image_id, 'thumbnail', true);
    
    					$return_html.= '<a>ID).'"><img class="alignright frame" src="'.$image_url[0].'" alt="" /></a>';
    				}
    
    				$return_html.= '<strong class="title"><a>ID).'">'.$post->post_title.'</a><span class="post_attribute">'.get_the_time('F j, Y', $post->ID).'</span>';
    				$return_html.= '</li>
    ';
    
    			}	
    
    		$return_html.= '';

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    can anyone help me?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags