WordPress widget to display posts from specific category

Posted on

WordPress widget to show posts from particular class

Open features.php file in your present theme. Copy the below-given code within the features.php file of your theme.

We use wp_reset_query() features to destroy the earlier question used on a customized loop.

Tips on how to use the shortcode?

Put [pk_get_posts] in your put up, pages or textual content widget.

Observe: The class parameter must be the ID of the class, and never the class title.

That shows all posts in all classes, to restrict put up show on particular class solely, add class parameter.

To restrict put up show use numberposts parameter.

So as to add extra parameters use parameters I’ve listed above.

If the shortcode didn’t work within the textual content widget, don’t fear.

Add this quick snippet in features.php of your theme.