Have you ever need to show news or event list in your website? If yes, than you want to be able to manage them easily. The list may be shown not only in your homepage but also in the sidebar in other pages. You may want a function that able to show the content as a teaser and updates accordingly whenever you add a new content.
This tutorial will show you how to add a news or event list using WordPress plugin called Content Views. This is a powerful plugin that you can use to list down all posts in your website based on its category, tag, and author without the needs to access the database. If you are familiar with Drupal, this plugin is similar to Drupal Views module. Let us start…
Step #1: Installing and enabling the plugin
You can start by installing the plugin in your WordPress site by searching ‘Content Views’ in your Dashboard add new plugin option. After done installing, enable the plugin from the installed plugins page.
You should now see a new ‘Content View Settings’ menu in you Dashboard. Before we create a new view, let’s prepare our content first.
Step #2: Adding Content for View
Let’s create a category first. For this tutorial, I will be using the Posts type for my news list. Feel free to use your own Custom Types if you prefer. Hover to ‘Posts’ menu and select ‘Categories’. Type your category name here. I will call mine ‘News’ because I will be creating a news list for the website.
Once done, add some new posts and remember to set each post categories as ‘News’. Here, I have created some example as my news. Once done, we are ready to create the view for listing the news.
Step #3: Adding View
Hover on the ‘Content View Settings’ menu in your Dashboard and click Add New. Add ‘News List’ for the title. Make sure ‘Post’ is selected as the content type. Choose the limit post that this view will list. Check the ‘Taxonomy (Categories, Tags…)’ under advanced filters and check category. Add the ‘News’ category that we have created earlier. Click the ‘Show Preview’ button and you will able to see the news list above.
Now what we want is to show are only the post title, date and teaser for the list. Click on the ‘Display Settings’ and follow below images for the setup. Click the ‘Update Preview’ button and you should see the changes above. Congratulation you have successfully created your first view.
You can now apply the views inside your page using its shortcode by going to the ‘Content Views Setting’ menu and clicking ‘All Views’.
If you are good in CSS, you can use the view class to create your own style such as below