Forums

[Plugin: List category posts] how to use the template (2 posts)

  1. genim
    Member
    Posted 2 years ago #

    i just want to know.. how to create a template for this plugin..

    and to use them in [catlist template=??] ?

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

  2. picandocodigo
    Member
    Posted 2 years ago #

    Take a look at the code on the default template included as an example.

    The main variable is $output, where you should load all the information you want to display.

    This is a new loop, what you see there is the code for how each of the posts will be shown. The example is using an unordered list (<ul>), but you can use headers, tables, whatever you like.

    These are some common functions you might want to use:

    Get the link to the post:
    get_permalink($single->ID)

    The title of the post:
    $single->post_title

    Author:
    get_userdata($single->post_author)
    To get the info. Save it into a variable like "$lcp_userdata", and then display it with:
    $lcp_userdata->user_nicename

    Get the excerpt:
    $single->post_excerpt

    Hope this helps. I'll add some of this info on the FAQ for future releases.

Topic Closed

This topic has been closed to new replies.

About this Topic