Display a list of posts in WordPress.com

To embed a list of posts in WordPress.com, display-posts shortcode is the way to generate this list. While WordPress.com already have a great documentation for this shortcode, I am going to highlight some extremely useful ones and add some notes to them:

author
[display-posts author="your_username"]
This display a list of posts published by given author.
Note: the author attribute is taking username, not the display name

category
[display-posts category="category_name"]
Display a list of posts belong to certain category(s)
Note:
The category name is not case-sensitive, so if you have a category name such as Admin's Log, then category="admin's log" or category="ADMIN'S LoG" works fine too. Notice it accepts special character as well 😉

tag
[display-posts tag="tag_name"]
Display a list posts belong to certain tag(s)
If you want a list with mutiple tag, just add a comma in between: tag = "tag1, tag2"

include_excerpt
[display-posts include_excerpt="true"]
Display a list of your posts with a short excerpt

include_date
[display-posts include_date="true"]
Display a list of your post name with date => (month/day/year)

wrapper
[display-posts wrapper="ol"]
Display the list in ordered list
Note: 3 options: uloldiv. => default is ul

posts_per_page
[display-posts posts_per_page="20"]
Display a list of posts with 20 items. If this attribute is not specified, the default value is 10
Note:
-1 means display all posts; having that said, display-posts has a limit of 100 items, so the following attribute will help

offset
[display-posts offset="20"]
Display a list of posts starting on the 20th item

 

 

And of course, you can join these attributes together and have something like:

[display-posts category="category_name" tag="tag_name" posts_per_page="3" include_excerpt="true" include_date="true"]

And I would get:

  • Hide directory tree in Apache server (3/1/2015) - Take me hours to figure this crap out. Anyways, here’s the short story:   Open apache configuration file: sudo nano /etc/apache2/apache2.conf   Scroll down to the <Directory /var/www/>. Add Options -Index and comment Option Indexes FollowSymLinks like so: <Directory /var/www/> Options -Indexes # Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>   That’s all … Continue reading
  • Server Setup on Instances (3/1/2015) - Install Apache sudo apt-get install apache2-mpm-prefork sudo a2enmod userdir sudo a2enmod expires Restart Apache sudo /etc/init.d/apache2 restart sudo service apache2 restart Install MySQL sudo apt-get install mysql-server mysql-client Create DB user in MySQL CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; CREATE DATABASE db_name; GRANT ALL ON db_name.* TO 'username'@'localhost'; Install PHP sudo apt-get install php5 libapache2-mod-php5 … Continue reading
  • Linux Commands (10/23/2014) - Remove directory and all the files/folders in it: rm -rf <folder_name> Copy a directory and all its contents: cp -a /source/. /dest/ Git commands Stage only modified files and not untracked ones git add -u Commit git commit -m 'your_message'

 

To find out more about this shortcode: https://en.support.wordpress.com/display-posts-shortcode/

Have fun with WordPress.com!!

Advertisements