Posts for Page Shortcode

Below, you’ll find a detailed guide on how to add the Posts for Page Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Posts for Page Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Posts for Page Plugin and the shortcodes it provides:

Plugin Icon
Posts for Page

"Posts for Page is a WordPress plugin designed to effortlessly display your blog posts on any page. With its user-friendly interface, it simplifies content management. Customize your website with ease."

★★★★☆ (13) Active Installs: 2000+ Tested with: 4.3.32 PHP Version: false
Included Shortcodes:
  • [posts-for-page]

Posts for Page [posts-for-page] Shortcode

The Posts-for-Page shortcode is a versatile tool that allows you to customize the display of posts on your WordPress pages. You can define the length of posts, add a ‘Read More’ text, and customize navigation with ‘Next’ and ‘Previous’ text. It also supports sorting by categories, tags, authors, and more. You can choose to show full posts or excerpts, hide images, and even strip HTML from the content. The shortcode ensures that your posts are displayed exactly how you want them.

Shortcode: [posts-for-page]

Parameters

Here is a list of all possible posts-for-page shortcode parameters and attributes:

  • length – Defines the length of the post excerpt
  • read_more – Custom text for the ‘read more’ link
  • prev_text – Custom text for the previous page link
  • next_text – Custom text for the next page link
  • cat_slug – Specifies a category using its slug
  • cat – Specifies a category using its ID
  • tag_slug – Specifies a tag using its slug
  • order_by – Determines the order of the posts
  • post_id – Specifies a specific post using its ID
  • author – Specifies posts from a certain author
  • num – Number of posts to show
  • show_full_posts – Determines if full posts are displayed
  • hide_images – Option to hide images in the posts
  • use_wp_excerpt – Option to use the WordPress excerpt function
  • strip_html – Option to remove HTML from the post content
  • hide_post_content – Option to hide the post content
  • show_meta – Option to show the post meta data
  • hide_post_title – Option to hide the post title
  • hide_read_more – Option to hide the ‘read more’ link
  • create_para_tags – Option to create paragraph tags in the post content
  • order – Specifies the order direction of the posts
  • force_excerpt_image – Forces an image in the excerpt
  • force_image_height – Forces a specific image height
  • force_image_width – Forces a specific image width

Examples and Usage

Basic example – Display posts from a specific category by referencing the category slug.

[posts-for-page cat_slug="news" /]

Advanced examples

Display posts from a specific category, limit the number of posts displayed, and customize the “Read More” text.

[posts-for-page cat_slug="news" num="5" read_more="Continue Reading..." /]

Display posts from a specific author, hide the post content, and customize the previous and next text.

[posts-for-page author="John" hide_post_content="true" prev_text="Previous Posts" next_text="Next Posts" /]

Display a specific post by ID, show the full post content, and hide the post title.

[posts-for-page post_id="123" show_full_posts="true" hide_post_title="true" /]

These examples demonstrate the flexibility of the shortcode and how it can be used to customize the display of posts on your WordPress site.

PHP Function Code

In case you have difficulties debugging what causing issues with [posts-for-page] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode("posts-for-page", "sc_posts_for_page");

Shortcode PHP function:

Code file location:

posts-for-page/posts-for-page/posts-for-page.php

Conclusion

Now that you’ve learned how to embed the Posts for Page Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *