{"id":64,"date":"2015-10-27T15:26:23","date_gmt":"2015-10-27T15:26:23","guid":{"rendered":"http:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/"},"modified":"2015-10-27T15:26:23","modified_gmt":"2015-10-27T15:26:23","slug":"simple-query-post-wordpress","status":"publish","type":"post","link":"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/","title":{"rendered":"Simple Query post wordpress"},"content":{"rendered":"<p>A simple query post wordpress to display post in any format you desire. Basically sometime you may need to call some limited number of post with specific category in certain place of your home page or any other template. This will require you to do some hand coding of wordpress inbuilt php function. WordPress has many easy to use php function that will fulfill your desire to show post. <\/p>\n<h2>Show post with simple Query post wordpress<\/h2>\n<pre><code>\n&lt;div class=\"boxKey\"&gt;\n&lt;?php\n$args = array(\n'post_type'=&gt; 'post',\n'category_name' =&gt; 'home',\n'order' =&gt; 'ASC'\n);\nquery_posts( $args );\n\/\/ The Loop\nwhile ( have_posts() ) : the_post(); ?&gt;\n&lt;div class=\"boxImg\"&gt;\n&lt;a href=\"&lt;?php the_permalink(); ?&gt;\"&gt; &lt;?php\nif ( has_post_thumbnail() ) {\nthe_post_thumbnail();\n}\n?&gt;&lt;\/a&gt;\n&lt;div class=\"boxTextKey\"&gt;\n&lt;h1&gt;&lt;?php the_title() ?&gt;&lt;\/h1&gt;\n&lt;p&gt;&lt;?php the_excerpt(); ?&gt; &lt;\/p&gt;\n&lt;\/div&gt;\n&lt;a href=\"&lt;?php the_permalink()?&gt;\" class=\"arrowKey\"&gt; &lt;\/a&gt;\n&lt;div class=\"clear\"&gt;&lt;\/div&gt;\n&lt;\/div&gt;\n&lt;?php\n\nendwhile;\n\n\/\/ Reset Query\n?&gt;\n\n&lt;?php wp_reset_query(); ?&gt;\n&lt;\/div&gt;\n&lt;!-- \/.boxKey --&gt;\n<\/code><\/pre>\n<h3>Arguments used for query post<\/h3>\n<pre><code>\n&lt;?php\n  $args = array(\n     'post_type'=&gt; 'post',\n     'category_name' =&gt; 'home',\n     'order' =&gt; 'ASC',\n     'cat=-1,-2,-3', \/\/excluding post on the base of category id\n  );\n?&gt;\n<\/code><\/pre>\n<p>For more detail information please visit <a href=\"https:\/\/codex.wordpress.org\/Function_Reference\/query_posts\">here<\/a><\/p>\n<p>The post <a rel=\"nofollow\" href=\"https:\/\/santosh-shah.com\/simple-query-post-wordpress\/\">Simple Query post wordpress<\/a> appeared first on <a rel=\"nofollow\" href=\"https:\/\/santosh-shah.com\/\">Santosh Shah<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A simple query post wordpress to display post in any format you desire. Basically sometime you may need to call some limited number of post with specific category in certain place of your home page or any other template. This will require you to do some hand coding of wordpress inbuilt php function. WordPress has [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-64","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Simple Query post wordpress - Santosh Kumar Shah<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Simple Query post wordpress - Santosh Kumar Shah\" \/>\n<meta property=\"og:description\" content=\"A simple query post wordpress to display post in any format you desire. Basically sometime you may need to call some limited number of post with specific category in certain place of your home page or any other template. This will require you to do some hand coding of wordpress inbuilt php function. WordPress has [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"Santosh Kumar Shah\" \/>\n<meta property=\"article:published_time\" content=\"2015-10-27T15:26:23+00:00\" \/>\n<meta name=\"author\" content=\"Santosh Kumar Shah\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Santosh Kumar Shah\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/\",\"url\":\"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/\",\"name\":\"Simple Query post wordpress - Santosh Kumar Shah\",\"isPartOf\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/#website\"},\"datePublished\":\"2015-10-27T15:26:23+00:00\",\"author\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f\"},\"breadcrumb\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/santosh-shah.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Simple Query post wordpress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#website\",\"url\":\"https:\/\/santosh-shah.com\/blog\/\",\"name\":\"Santosh Kumar Shah\",\"description\":\"JavaScript Developer\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/santosh-shah.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f\",\"name\":\"Santosh Kumar Shah\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g\",\"caption\":\"Santosh Kumar Shah\"},\"description\":\"I am JavaScript developer.\",\"sameAs\":[\"https:\/\/santosh-shah.com\/blog\"],\"url\":\"https:\/\/santosh-shah.com\/blog\/author\/sks7yu\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Simple Query post wordpress - Santosh Kumar Shah","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/","og_locale":"en_US","og_type":"article","og_title":"Simple Query post wordpress - Santosh Kumar Shah","og_description":"A simple query post wordpress to display post in any format you desire. Basically sometime you may need to call some limited number of post with specific category in certain place of your home page or any other template. This will require you to do some hand coding of wordpress inbuilt php function. WordPress has [&hellip;]","og_url":"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/","og_site_name":"Santosh Kumar Shah","article_published_time":"2015-10-27T15:26:23+00:00","author":"Santosh Kumar Shah","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Santosh Kumar Shah","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/","url":"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/","name":"Simple Query post wordpress - Santosh Kumar Shah","isPartOf":{"@id":"https:\/\/santosh-shah.com\/blog\/#website"},"datePublished":"2015-10-27T15:26:23+00:00","author":{"@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f"},"breadcrumb":{"@id":"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/santosh-shah.com\/blog\/simple-query-post-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/santosh-shah.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Simple Query post wordpress"}]},{"@type":"WebSite","@id":"https:\/\/santosh-shah.com\/blog\/#website","url":"https:\/\/santosh-shah.com\/blog\/","name":"Santosh Kumar Shah","description":"JavaScript Developer","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/santosh-shah.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f","name":"Santosh Kumar Shah","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g","caption":"Santosh Kumar Shah"},"description":"I am JavaScript developer.","sameAs":["https:\/\/santosh-shah.com\/blog"],"url":"https:\/\/santosh-shah.com\/blog\/author\/sks7yu\/"}]}},"_links":{"self":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/comments?post=64"}],"version-history":[{"count":0,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts\/64\/revisions"}],"wp:attachment":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/media?parent=64"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/categories?post=64"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/tags?post=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}