Tag Archives: display-posts

Create category post widget in WordPress


We have learned ho to manipulate WordPress posts using short code and display-posts, if you miss any, following list will help you

Widgets

Widgets are the objects or controls that can be place in side bars, you can customize them using the Customize button under Design [Block Editor] or Appearance – Customize [ Classic Editor/WP-Admin panel].

Our aim is to create a Text Widget  for side bar and place some category post inside.

  1. Create Text Widget using Customize Widget
  2. add the following Short code in the content section
display-posts category="WordPress"
[above code her]

That’s all , you can see live view of widget example at the top right sidebar titled as WordPress Tips

List category posts in WordPress


I have went through a beautiful Jetpack plugin, display-posts, in case you miss them here is the  posts I recommend.

Category Post

What is category post ? Post that are composed in specific category is called category posts. All posts are category posts. 

How do we list them ? 

Using display-posts we can make a list of posts. So let’s build a list with short code

display-posts category="Python"
[above lines here]

The above short code can place any where in the content area which list Category posts lies under Python

 

Display post inside another post/Page in WordPress


We have learned so far how to use listing projects with short codes , with content, excerpts, image and lots of customization. If you ever miss them here it is

Post inside a Post

Place a post inside another post or page.  Sound crazy ? You can do this with Display-posts plugin which can be used as short code .

Do you know that you can place short code  not only in  short code block but also a paragraph block or in classic editor  as [ short code here].

First we have to find the post ID ( each WP post comes with unique post id, you can find them in posts by pointing the post title, in the status bars it will show as post=2005)  , since we need a single post and use it in short code as follows.

As we all know short code appear inside of opening( [ ) and closing (]) square brackets.

Short code
display-posts id=2419 include_content=true
[ short code here ]
display-posts

display-posts – Example

Using the id  we can specify the post ids, in case of multiple post separate with comma (,) , also want to show content after the title , so used the include_content option which is by default set to false.