If you use the include_date=”true” parameter, Display Posts will include the post’s date using the (n/j/Y) format. Ex: You can customize this using the date_format parameter (see Formatting Dates and Times). WordPress lets you specify a default date format in Settings > General > Date Format. If you would like to use that format in […]
Change the default arguments of the shortcode. For instance, if you want all shortcodes to have include_excerpt=”true” and include_author=”true”, you could use this to set it once and then not have to include those parameters on all shortcodes.
Display post count as title of listing
You can use the title parameter in the shortcode to add a title above the listing of posts. But what if you want that title to dynamically include the post count? We’ll use the shortcode_atts_display-posts filter to modify the default parameters for the shortcode. If the shortcode does not have a title specified, we’ll give […]
Change Default Attributes
If you find yourself typing the same parameters over and over, you can save time by changing the default attributes. These can always be overridden by specifying new attributes on an individual shortcode. For instance, let’s say you always list 20 posts with excerpts: We can use the following to set these as the default: […]