So.. I made a “list-category-posts” folder in the wp-content/themes/my-theme-folder and after I copied the default.php there from the template folder. Actually I copied the templatename.php because before I copied it I renamed it from default.php to templatename.php
That’s all very good. I assume you also added template=templatename
to your shortcode.
Before I copied it into the folder I copied the code what I got from you into the templatename.php file. I think this is what I had to do and I also think it works because the view/style is little bit changed, but still doesnt dislay the categories beside each line.
Yes, that code was supposed to go into the template file, but the important thing is where you paste it. What interests us here is the part within WP Loop i.e. is responsible for every individual post:
global $post;
while ( have_posts() ):
the_post();
//Start a List Item for each post:
$lcp_display_output .= "<li>";
//Show the title and link to the post:
$lcp_display_output .= $this->get_post_title($post, 'h3', 'lcp_post');
//Show comments:
$lcp_display_output .= $this->get_comments($post);
//Show date:
$lcp_display_output .= ' ' . $this->get_date($post);
//Show date modified:
$lcp_display_output .= ' ' . $this->get_modified_date($post);
//Show author
$lcp_display_output .= $this->get_author($post);
//Custom fields:
$lcp_display_output .= $this->get_custom_fields($post);
//Post Thumbnail
$lcp_display_output .= $this->get_thumbnail($post);
/**
* Post content - Example of how to use tag and class parameters:
* This will produce:<p class="lcp_content">The content</p>
*/
$lcp_display_output .= $this->get_content($post, 'p', 'lcp_content');
/**
* Post content - Example of how to use tag and class parameters:
* This will produce:<div class="lcp_excerpt">The content</div>
*/
$lcp_display_output .= $this->get_excerpt($post, 'div', 'lcp_excerpt');
// Get Posts "More" link:
$lcp_display_output .= $this->get_posts_morelink($post);
//Close li tag
$lcp_display_output .= '</li>';
endwhile;
As you can see there is code responsible for rendering date, author, etc. You need to paste the code I gave you into this section of the template. For instance, if you’d like the categories to be displayed at the very end, put the new code just above
//Close li tag
$lcp_display_output .= '</li>';
-
This reply was modified 6 years, 7 months ago by zymeth25.