{"id":1261,"date":"2023-10-26T13:28:26","date_gmt":"2023-10-26T13:28:26","guid":{"rendered":"https:\/\/wpshortcode.org\/?p=1261"},"modified":"2023-10-26T13:28:27","modified_gmt":"2023-10-26T13:28:27","slug":"posts-in-page","status":"publish","type":"post","link":"https:\/\/wpshortcode.org\/posts-in-page\/","title":{"rendered":"Posts in Page Shortcodes"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Below, you&#8217;ll find a detailed guide on how to add the <strong>Posts in Page Shortcodes<\/strong> to your WordPress website, including their <strong>parameters<\/strong>, <strong>examples<\/strong>, and <strong>PHP function code<\/strong>. Additionally, we&#8217;ll assist you with common issues that might cause the Posts in Page Plugin shortcodes not to show or not to work correctly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before starting, here is an overview of the Posts in Page Plugin and the shortcodes it provides:<\/p>\n\n\n<p>    <div class=\"plugin-info-box\">\n        <div class=\"top-main\">\n            <!-- SVG Image -->\n            <div class=\"plugin-image\">\n                <img decoding=\"async\" src=\"https:\/\/ps.w.org\/posts-in-page\/assets\/icon-128x128.png?rev=1596190\" alt=\"Plugin Icon\" \/>\n            <\/div>\n            \n            <div class=\"plugin-descriptive-part\">\n                <!-- Plugin Name with Link -->\n\n                    <a class=\"plugin-title\" href=\"https:\/\/wordpress.org\/plugins\/posts-in-page\" target=\"_blank\" rel=\"noopener\">\n                        Posts in Page                    <\/a>\n\n\n                <!-- Plugin Description -->\n                <p class=\"plugin-description\">\n                    &quot;Posts in Page is a WordPress plugin that seamlessly integrates your blog posts into any page. It&#039;s a versatile tool designed to enhance the organization and presentation of your content.&quot;                <\/p>\n            <\/div>\n        <\/div>\n\n        <!-- Rating and Additional Info -->\n        <div class=\"plugin-meta\">\n            <span class=\"plugin-rating\">\n                <span class='stars'>\u2605\u2605\u2605\u2605\u2729<\/span> (86)\n            <\/span>\n            <span class=\"plugin-active-installs\">\n                <strong>Active Installs<\/strong>: 20000+\n            <\/span>\n            <span class=\"plugin-tested\">\n                <strong>Tested with<\/strong>: 5.2.19            <\/span>\n            <span class=\"plugin-php-version\">\n                <strong>PHP Version<\/strong>: false            <\/span>\n        <\/div>\n\n        <!-- List of Included Shortcodes -->\n        <div class=\"plugin-shortcodes\">\n            <strong>Included Shortcodes:<\/strong>\n            <ul>\n                <li>[ic_add_posts]<\/li><li>[ic_add_post]<\/li>            <\/ul>\n        <\/div>\n    <\/div>\n    <\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Posts in Page [ic_add_posts] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8216;ic_add_posts&#8217; shortcode is a powerful tool provided by the Posts-in-Page plugin. It fetches and displays posts on a specified page.\n\n\n\nThe PHP function &#8216;posts_in_page&#8217; uses this shortcode to create a new ICPagePosts object. It then returns the output of the posts, allowing for seamless integration of posts within your pages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[ic_add_posts]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic Example<\/strong> &#8211; In this basic example, the shortcode is used without any parameters. Hence, it will display the posts as per the default settings.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[ic_add_posts]<\/code><\/pre>\n\n\n<p><strong>Advanced Examples<\/strong><\/p>\n<p>In the first advanced example, the shortcode is used with the &#8216;category&#8217; parameter. This will display posts from the specified category. For instance, if you want to display posts from the &#8216;news&#8217; category, the shortcode would look like this:<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[ic_add_posts category='news']<\/code><\/pre>\n\n\n<p>In the second advanced example, the shortcode is used with multiple parameters. Here, it is used with the &#8216;category&#8217; and &#8216;showposts&#8217; parameters. This will display a certain number of posts from the specified category. For instance, if you want to display 5 posts from the &#8216;news&#8217; category, the shortcode would look like this:<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[ic_add_posts category='news' showposts='5']<\/code><\/pre>\n\n\n<p>In the third advanced example, the shortcode is used with the &#8216;tag&#8217; parameter. This will display posts with the specified tag. For instance, if you want to display posts with the tag &#8216;WordPress&#8217;, the shortcode would look like this:<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[ic_add_posts tag='WordPress']<\/code><\/pre>\n\n\n<p>In the fourth advanced example, the shortcode is used with the &#8216;post_type&#8217; parameter. This will display posts of the specified post type. For instance, if you want to display posts of the post type &#8216;product&#8217;, the shortcode would look like this:<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[ic_add_posts post_type='product']<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[ic_add_posts]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'ic_add_posts', array( $this, 'posts_in_page' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction posts_in_page( $atts ) {\n\t\t$posts = new ICPagePosts( $atts );\n\n\t\treturn $posts-&gt;output_posts();\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">posts-in-page\/posts-in-page\/posts_in_page.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Posts in Page [ic_add_post] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8216;ic_add_post&#8217; shortcode from the Posts-in-Page plugin is designed to add specific posts within a page. \n\n\n\nThis shortcode executes the &#8216;post_in_page&#8217; function, which calls the &#8216;posts_in_page&#8217; method. This method retrieves and displays the specified posts within the page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[ic_add_post]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; Utilizing the shortcode to add a specific post in a page by referencing the post&#8217;s ID.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[ic_add_post id=1 \/]<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[ic_add_post]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'ic_add_post', array( $this, 'post_in_page' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction post_in_page( $atts ) {\n\t\treturn self::posts_in_page( $atts );\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">posts-in-page\/posts-in-page\/posts_in_page.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now that you&#8217;ve learned how to embed the <strong>Posts in Page Plugin shortcodes<\/strong>, understood the parameters, and seen code examples, it&#8217;s easy to use and debug any issue that might cause it to &#8216;not work&#8217;. If you still have difficulties with it, don&#8217;t hesitate to leave a comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Below, you&#8217;ll find a detailed guide on how to add the Posts in Page Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we&#8217;ll assist you with common issues that might cause the Posts in Page Plugin shortcodes not to show or not to work correctly. Before starting, here is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"name":"Posts in Page","slug":"","version":"1.4.4","author":"<a href=\"https:\/\/ivycat.com\/wordpress\/\">IvyCat, Inc.<\/a>","icons":"https:\/\/ps.w.org\/posts-in-page\/assets\/icon-128x128.png?rev=1596190","plugin_tags":"{\"custom-post-types\":\"custom post types\",\"pages\":\"pages\",\"posts\":\"posts\",\"shortcode\":\"shortcode\",\"taxonomy\":\"taxonomy\"}","author_profile":"https:\/\/profiles.wordpress.org\/ivycat\/","requires":"3.0","tested":"5.2.19","requires_php":"false","rating":88,"num_ratings":86,"active_installs":20000,"downloaded":372600,"last_updated":"2019-05-13 4:13pm GMT","added":"2012-02-27","homepage":"https:\/\/ivycat.com\/wordpress\/wordpress-plugins\/posts-in-page\/","short_description":"Easily add one or more posts to any page using simple shortcodes.","description":"\"Posts in Page is a WordPress plugin that seamlessly integrates your blog posts into any page. It's a versatile tool designed to enhance the organization and presentation of your content.\"","shortcodes":"[\"ic_add_posts\",\"ic_add_post\"]","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1261","post","type-post","status-publish","format-standard","hentry","category-plugins"],"_links":{"self":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/1261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/comments?post=1261"}],"version-history":[{"count":1,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/1261\/revisions"}],"predecessor-version":[{"id":1532,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/1261\/revisions\/1532"}],"wp:attachment":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/media?parent=1261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/categories?post=1261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/tags?post=1261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}