Skip to content

More parameters you can use

Klemens Starybrat edited this page Aug 20, 2022 · 20 revisions

Other parameters

  • conditional_title - Display a custom title before the posts list. The title is not displayed if the list is empty. Set to the empty string (default value) to disable. Example: [catlist conditional_title="Other posts"]. You can set a css class and an html tag to wrap the title in with conditional_title_class and conditional_title_tag (see HTML & CSS Customization). Tag defaults to h3.

  • orderby - To customize the order. Valid values are:

    • author - Sort by the numeric author IDs.
    • category - Sort by the numeric category IDs.
    • content - Sort by content.
    • date - Sort by creation date.
    • ID - Sort by numeric post ID.
    • menu_order - Sort by the menu order. Only useful with pages.
    • mime_type - Sort by MIME type. Only useful with attachments.
    • modified - Sort by last modified date.
    • name - Sort by stub.
    • parent - Sort by parent ID.
    • password - Sort by password.
    • rand - Randomly sort results.
    • status - Sort by status.
    • title - Sort by title.
    • type - Sort by type. Ex: [catlist name=mycategory orderby=date]
  • customfield_orderby - You can order the posts by a custom field. For example: [catlist numberposts=-1 customfield_orderby=Mood order=desc] will list all the posts with a "Mood" custom field. This parameter can be used toghether with customfield_name and customfield_value, you can use those parameters to select posts and then customfield_orderby to sort by this or another custom field. For other than alphabetical sorting, you can use the customfield_orderby_type parameter. Remember the default order is descending.

  • customfield_orderby_type - You can use the customfield_orderby_type parameter to specify how the values are to be interpreted i.e. select a proper data type: NUMERIC, BINARY, CHAR, DATE, DATETIME, DECIMAL, SIGNED, TIME, UNSIGNED. The default is CHAR. For example, if you want to order by a custom field that contains numbers, you should use customfield_orderby_type=NUMERIC because the default CHAR will parse the values as strings where 2 is a higher value than 10 which is not what you want.

  • keep_orderby_filters - By default the plugin removes all filters added to the 'posts_orderby' hook to prevent interference from other plugins/themes. While this makes the LCP plugin free from ordering options set elsewhere, it also disables these filters for any element on a page where the LCP plugin is used. Use keep_orderby_filters=yes if you want to disable this behaviour, you can then use another plugin for custom ordering.

  • order - How to sort orderby. Valid values are:

    • ASC - Ascending (lowest to highest).
    • DESC - Descending (highest to lowest). This is the default. Ex: [catlist name=mycategory orderby=title order=asc]
  • numberposts - Number of posts to return. Set to 0 to use the max number of posts per page. Set to -1 to remove the limit. Ex: [catlist name=mycategory numberposts=10] You can set the default number of posts globally on the options page on your Dashboard in Settings / List Category Posts.

  • no_posts_text - Text to display when no posts are found. If you don't specify it, nothing will get displayed where the posts should be.

  • date - Display post's date next to the title. Default is 'no', use date=yes to activate it. You can set a css class and an html tag to wrap the date in with date_class and date_tag (see HTML & CSS Customization).

  • date_modified - Display the date a post was last modified next to the title. You can set a css class and an html tag to wrap the date in with date_modified_class and date_modified_tag (see HTML & CSS Customization).

  • author - Display the post's author next to the title. Default is 'no', use author=yes to activate it. You can set a css class and an html tag to wrap the author name in with author_class and author_tag (see HTML & CSS Customization).

    When displaying the post author, you can also display a link to the author's page. The following parameter only works if author=yes is present in the shortcode:

    • author_posts_link - Gets the URL of the author page for the author. The HTML and CSS customization are the ones applied to author.
  • dateformat - Format of the date output. The default format is the one you've set on your WordPress settings. Example: [catlist id=42 dateformat="l F dS, Y"] would display the date as "Monday January 21st, 2013". Check http://codex.wordpress.org/Formatting_Date_and_Time for more options to display date.

  • excerpt - Display a plain text excerpt of the post. Default is 'no', use excerpt=yes or excerpt=full to activate it. If you have a separate excerpt in your post, this text will be used. If you don't have an explicit excerpt in your post, the plugin will generate one from the content, striping its images, shortcodes and HTML tags. If you want to overwrite the post's separate excerpt with an automatically generated one (may be useful to allow HTML tags), use excerpt_overwrite=yes.

    If you use excerpt=yes, the separate excerpt or content will be limited to the number of words set by the excerpt_size parameter (55 words by default).

    If you use excerpt=full the plugin will act more like Wordpress. If the post has a separate excerpt, it will be used in full. Otherwise if the content has a <!--more--> tag then the excerpt will be the text before this tag, and if there is no <!--more--> tag then the result will be the same as excerpt=yes.

    If you want the automatically generated excerpt to respect your theme's allowed HTML tags, you should use excerpt_strip=no, otherwise the HTML tags are automatically stripped.

    Both excerpt=yes and excerpt=full are passed to the_excerpt filters. Note that before v0.84 this only applied to excerpt=yes.

    You can set a css class and an html tag to wrap the excerpt in with excerpt_class and excerpt_tag (see HTML & CSS Customization).

  • excerpt_size - Set the number of words to display from the excerpt. Default is 55. Eg: excerpt_size=30

  • excerpt_strip - Set it to yes to strip the excerpt's HTML tags. If the excerpt is auto generated by the plugin, the HTML tags will be stripped, and you should use excerpt_strip=no to see the excerpt with HTML formatting.

  • title_limit - Set the limit of characters for the title. Ex: [catlist id=2 title_limit=50] will show only the first 50 characters of the title and add "…" at the end.

  • content - WARNING: If you want to show the content on your listed posts, you might want to do this from a new Page Template or a Custom Post Type Template. Using this parameter is discouraged, you can have memory issues as well as infinite loop situations when you're displaying a post that's using List Category Posts. You have been warned. Usage:

    • yes - Show the excerpt or full content of the post. If there's a <!--more--> tag in the post, then it will behave just as WordPress does: only show the content previous to the more tag. Default is 'no'. Ex: [catlist content=yes]

    • full - Show the full content of the post regardless of whether there is a <!--more--> tag in the post. Ex: [catlist content=full]

    You can set a css class and an html tag to wrap the content in with content_class and content_tag (see HTML & CSS Customization).

  • catlink - Show the title of the category with a link to the category. Use the catlink_string option to change the link text. Default is 'no'. Ex: [catlist catlink=yes]. When using more than one category a title of each of them is displayed. You can set a css class and an html tag to wrap the link in with catlink_class and catlink_tag (see HTML & CSS Customization). Tag defaults to strong.

  • catlink_tag - Specify the tag used for catlink. Must be specified to use catlink_class

  • catlink_class - Specify the class used for catlink. Must specify catlink_tag. Defaults to the empty string (no special class).

  • category_description Show the category description wrapped in a p tag: [catlist id=1 category_description='yes']

  • catname - Show the title of the category (or categories), works exactly as catlink, but it doesn't add a link to the category. You can also use catlink_tag and catlink_class with this parameter.

  • category_count - Shows the posts count in that category, only works when using the catlink option: [catlist name=nintendo catlink=yes category_count=yes]

  • comments - Show comments count for each post. Default is 'no'. Ex: [catlist comments=yes]. You can set a css class and an html tag to wrap the comments count in with comments_class and comments_tag (see HTML & CSS Customization).

  • thumbnail - Show post thumbnail (http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/). Default is 'no'. Ex: [catlist thumbnail=yes].

  • force_thumbnail - If the previous parameter is set to 'yes', and there's no featured image, setting this to 'yes' or 'true' will make the plugin look for the first image in the post and use it as a thumbnail. Ex: [catlist thumbnail=yes force_thumbnail=yes].

  • thumbnail_size - Either a string keyword (thumbnail, medium, large or full) or 2 values representing width and height in pixels. Ex: [catlist thumbnail_size=32,32] or [catlist thumbnail_size=thumbnail]

  • thumbnail_class - Set a CSS class for the thumbnail.

  • post_suffix - Pass a String to this parameter to display this String after every post title. Ex: [catlist numberposts=-1 post_suffix="Hello World"] will create something like:

    <ul class="lcp_catlist" id=lcp_instance_0>
      <li>
        <a href="http://127.0.0.1:8080/wordpress/?p=42" title="WordPress">
          WordPress
        </a>
        Hello World
      </li>
    </ul>
  • display_id - Set it to yes to show the Post's ID next to the post title: [catlist id=3 display_id=yes]

  • class - CSS class for the default UL generated by the plugin.

  • tags_as_class - Use a post's tags as a class for the li that lists the posts. Default is no. For example, [catlist tags_as_class=yes] will show a post that has the fun tag like this:

<li class=" fun ">
  <a href="http://localhost:8080/?p=1267" title="Post Title">Post Title</a>
</li>
  • customfield_display - Display custom field(s). You can specify many fields to show, separating them with a comma. If you want to display just the value and not the name of the custom field, use customfield_display_name and set it to no. By default, the custom fields will show inside a div with a specific class: <div class="lcp-customfield">. You can customize this using the customfield_tag and customfield_class parameters to set a different tag (instead of the div) and a specific class (instead of lcp-customfield).

  • customfield_display_glue - Specify the text to appear between two custom fields if displayed together, defaults to the empty string. Not used if the customfield_display_separately parameter is defined.

  • customfield_display_separately - Display the custom fields separately. Each custom field is displayd within its own tag (see customfield_tag). Defaults to 'no', set to 'yes' to enable. Superseeds the customfield_display_glue parameter when enabled.

  • customfield_display_name - To use with customfield_display. Use it to just print the value of the Custom field and not the name. Example: [catlist numberposts=-1 customfield_display="Mood" customfield_display_name="no"] Will print the value of the Custom Field "Mood" but not the text "Mood: [value]".

  • customfield_display_name_glue - To use with customfield_display_name. Use it to specify the text between the name and the value, defaults to ' : '.

  • template - By default, posts will be listed in an unordered list (ul tag) with the class 'lcp_catlist':

    <ul class="lcp_catlist"><li><a href="post1">Post 1</a></li>...

    You can use a different class by using the class parameter.

    You can create your own template file (Check Template System) and pass it as a parameter here. The parameter is the template name without the extension. For example for mytemplate.php, the value would be mytemplate.

    You can also pass these two parameters which yield different results:

    • div - This will output a div with the lcp_catlist class (or one you pass as a parameter with the class argument). The posts will be displayed between p tags. [catlist template=div]

    • ol - This will output an ordered list with the lcp_catlist css class (or the one you pass as a parameter with the class argument) and each post will be a list item inside the ordered list. [catlist template=ol].

  • morelink - Include a "more" link to access the category archive for the category. The link is inserted after listing the posts. It receives a string of characters as a parameter which will be used as the text of the link. Example: [catlist id=38 morelink="Read more"] You can set a css class and an html tag to wrap the link in with morelink_class and morelink_tag (see HTML & CSS Customization).

  • posts_cats - if set to yes will enable displaying each post's categories. Use the following parameters to customise this feature:

    • posts_cats_prefix - a string displayed before the categories; defaults to 1 whitespace.
    • posts_cats_glue - a string to insert between the categories; defaults to , (comma and whitespace).
    • posts_cats_inner - html tag to wrap each post's category with, if set will also automatically add classes prefixed with cat- based on categories' slugs, e.g. if the slug is 'news' then posts_cats_inner=span renders <span class="cat-news">News</span>; default: empty
    • posts_catlink - similar to catlink, if set to yes each category name links to its archive page; disabled by default.
    • posts_cats_tag and posts_cats_class - they work just like all other parameters described in HTML & CSS Customization, the entire output of this feature is wrapped as specified by these parameters; empty by default.
  • posts_tags, posts_tags_prefix, posts_tags_glue, posts_tags_inner, posts_taglink, posts_tags_tag, posts_tags_class - these parameters work exactly the same as the feature described above but for posts' tags, not categories.

  • posts_morelink - Include a "read more" link after each post. It receives a string of characters as a parameter which will be used as the text of the link. Example: [catlist id=38 posts_morelink="Read more about this post"]

  • link_target - Select the target attribute for links to posts (target=_blank, _self, _parent, _top, framename). Example: [catlink id=3 link_target=_blank] will create: <a href="http://localhost/wordpress/?p=45" title="Test post" target="_blank">Test post</a>

  • no_post_titles - If set to yes, no post titles will be shown. This may make sense together with content=yes.

  • link_titles - Option to display titles without links. If set to false, the post titles won't be linking to the article.

  • link_current - Set to no to prevent the current posts title from being wrapped in a link.

  • link_dates - Option to wrap dates with a link to the post. Set to true or yes to enable, set to false or no to disable. Defaults to false.

  • main_query - If set to no the plugin will run a standard secondary loop, the default behavior is to run a main query. You should use it in any LCP shortcode that is not intended to generate main content of a page (sidebars, footers, any secondary lists). It will also prevent the query from being affected by main query's conditional tags like is_category() etc.

Clone this wiki locally