WordPress.org

Support

Support » Plugins and Hacks » [Plugin: List category posts] Need help reordering so that date comes first

[Plugin: List category posts] Need help reordering so that date comes first

  • I’m using the template parameter and I’ve created the following code. The issue is it doesn’t wrap the list items in an unordered ( <ul class=”lcp_catlist”> ) list like the default version does.

    THIS IS MY VERSION

    //Show category?
    if ($cat_link_string != ''){
    	$output = '<p><strong>' . $cat_link_string . '</strong></p>';
    }else{
    	$output = '';
    }
    //Posts loop:
    foreach($catposts as $single):
    	$output.= '<li>' . get_the_time($atts['dateformat'], $single);
    	$output .= ''.'<a href="' . get_permalink($single->ID) . '">' . $single->post_title . '</a>';
    
    	//Show author?
    	if($atts['author']=='yes'){
    		$lcp_userdata = get_userdata($single->post_author);
    		$output.=" - ".$lcp_userdata->user_nicename;
    	}
    	//Show content?
    	if($atts['content']=='yes' && $single->post_content){
    		$output .= "<p>$single->post_content</p>";
    	}
    	//Show excerpt?
    	if($atts['excerpt']=='yes' && $single->post_excerpt && !($atts['content']=='yes' && $single->post_content) ){
    		$output .= '<p>' . $single->post_excerpt . '</p>';
    	}
    	$output.='</li>';
    endforeach;
    ?>

    THIS IS THE DEFAULT VERSION

    //Show category?
    if ($cat_link_string != ''){
    	$output = '<p><strong>' . $cat_link_string . '</strong></p>';
    }else{
    	$output = '';
    }
    //Posts loop:
    foreach($catposts as $single):
    	$output .= '<li><a href="' . get_permalink($single->ID) . '">' . $single->post_title . '</a>';
    	//Style for date:
    	if($atts['date']=='yes'){
    		$output.= ' - ' . get_the_time($atts['dateformat'], $single);
    	}
    	//Show author?
    	if($atts['author']=='yes'){
    		$lcp_userdata = get_userdata($single->post_author);
    		$output.=" - ".$lcp_userdata->user_nicename;
    	}
    	//Show content?
    	if($atts['content']=='yes' && $single->post_content){
    		$output .= "<p>$single->post_content</p>";
    	}
    	//Show excerpt?
    	if($atts['excerpt']=='yes' && $single->post_excerpt && !($atts['content']=='yes' && $single->post_content) ){
    		$output .= '<p>' . $single->post_excerpt . '</p>';
    	}
    	$output.='</li>';
    endforeach;
    ?>

    http://wordpress.org/extend/plugins/list-category-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • OK, I just tried renaming the default page to default2 and using that one, unchanged. It also doesn’t wrap the LIST with an UNORDERED LIST. Looking deeper…

    OK, the provided template is just missing the unordered list wrapper.
    This works>>>>

    //Show category?
    if ($cat_link_string != ''){
    	$output = '<p><strong>' . $cat_link_string . '</strong></p>';
    }else{
    	$output = '';
    }
    $output .= '<ul class="lcp_catlist">';//For default ul
    //Posts loop:
    foreach($catposts as $single):
    	$output .= '<li>' . get_the_time($atts['dateformat'], $single);
    	$output.= '<br />'.'<a href="' . get_permalink($single->ID) . '">' . $single->post_title . '</a>';
    
    	//Show author?
    	if($atts['author']=='yes'){
    		$lcp_userdata = get_userdata($single->post_author);
    		$output.=" - ".$lcp_userdata->user_nicename;
    	}
    	//Show content?
    	if($atts['content']=='yes' && $single->post_content){
    		$output .= "<p>$single->post_content</p>";
    	}
    	//Show excerpt?
    	if($atts['excerpt']=='yes' && $single->post_excerpt && !($atts['content']=='yes' && $single->post_content) ){
    		$output .= '<p>' . $single->post_excerpt . '</p>';
    	}
    	$output.='</li>';
    endforeach;
    $output .= "</ul>";
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: List category posts] Need help reordering so that date comes first’ is closed to new replies.