Support » Plugin: List category posts » [Plugin: List category posts] Comma separated list of post titles

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter cosmicjellybaby

    (@cosmicjellybaby)

    I have had a go at doing this and it looks like it might be ok, it’s just that I am getting other pieces of code included within my ‘ul’ tags.

    Here’s what is in my template:

    $lcp_display_output = '';
    
    $lcp_display_output .= $this->get_category_link('strong');
    
    $lcp_display_output .= '<ul class="comma_separated">';
    
    // Posts loop.
    
    	$lcp_display_output .= '';
    
        foreach ($this->catlist->get_categories_posts() as $single):
    
            $lcp_display_output .= $this->get_post_title($single);
    	$lcp_display_output .= ', ';
    
        endforeach;
    
    echo rtrim($lcp_display_output, ', ');
    
        $lcp_display_output .= '</ul>';

    Any thoughts? It can be viewed here: http://iwantfootball.co.uk/uncategorized/test-page-comma-separated-list-using-template

    Thread Starter cosmicjellybaby

    (@cosmicjellybaby)

    OK, so I’ve played some more and I can now get the output from the plugin to be contained within its ul tags. The only problem is now that the output is appearing at the top of the div which contains the text of my post, regardless of where I have laid it out in the wordpress edit post pane. This is my template info:

    $lcp_display_output = '';
    
    $lcp_display_output .= $this->get_category_link('strong');
    
    $lcp_display_output .= '<ul class="comma_separated">';
    
    // Posts loop.
    
    $lcp_display_output .= '';
    
    	foreach ($this->catlist->get_categories_posts() as $single):
    
            $lcp_display_output .= $this->get_post_title($single). ", ";
    
            endforeach;
    
    $lcp_display_output = rtrim($lcp_display_output , ', ');
    
        $lcp_display_output .= '</ul>';
    
    	echo $lcp_display_output ;

    Any thoughts?

    the output is appearing at the top of the div which contains the text of my post, regardless of where I have laid it out in the wordpress edit post pane

    try to use return $lcp_display_output ;

    (I haven’t checked the rest of the code)

    Thread Starter cosmicjellybaby

    (@cosmicjellybaby)

    Thanks for your input alchymyth. I tried it, but to no avail. However, I did reinstate the original output line of
    $this->lcp_output = $lcp_display_output;
    and bingo! It works perfectly! Not sure why I removed it in the first place… 😉

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: List category posts] Comma separated list of post titles’ is closed to new replies.