{"id":505,"date":"2012-02-12T13:46:11","date_gmt":"2012-02-12T13:46:11","guid":{"rendered":"http:\/\/www.vishmax.com\/en\/?p=505"},"modified":"2012-05-19T13:17:40","modified_gmt":"2012-05-19T13:17:40","slug":"wordpress-loop-a-working-tutorial","status":"publish","type":"post","link":"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/","title":{"rendered":"WordPress Loop &#8211; A Working Tutorial"},"content":{"rendered":"<p>Here is an tutorial to WordPress Loop which displays posts with it\u2019s title.<\/p>\n<pre lang=\"php\">\r\n<!-- Start the Loop. -->\r\n <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>\r\n \r\n <!-- The following tests if the current post is in category 3. -->\r\n <!-- If it is, the div box is given the CSS class \"post-cat-three\". -->\r\n <!-- Otherwise, the div box will be given the CSS class \"post\". -->\r\n <?php if ( in_category('3') ) { ?>\r\n           <div class=\"post-cat-three\">\r\n <?php } else { ?>\r\n           <div class=\"post\">\r\n <?php } ?>\r\n \r\n <!-- Display the Title as a link to the Post's permalink. -->\r\n <h2><a href=\"<?php the_permalink() ?>\" rel=\"bookmark\" title=\"Permanent Link to <?php the_title_attribute(); ?>\"><?php the_title(); ?><\/a><\/h2>\r\n \r\n <!-- Display the date (Feb 19th, 2012 format) and a link to other posts by this posts author. -->\r\n <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?><\/small>\r\n \r\n <!-- Display the Post's Content in a div box. -->\r\n <div class=\"entry\">\r\n   <?php the_content(); ?>\r\n <\/div>\r\n \r\n <!-- Display a comma separated list of the Post's Categories. -->\r\n <p class=\"postmetadata\">Posted in <?php the_category(', '); ?><\/p>\r\n <\/div> <!-- closes the first div box -->\r\n <\/div><\/\r\n \r\n <!-- Stop The Loop (but note the \"else:\" - see next line). -->\r\n <?php endwhile; else: ?>\r\n \r\n <!-- The very first \"if\" tested to see if there were any Posts to -->\r\n <!-- display.  This \"else\" part tells what do if there weren't any. -->\r\n <p>Sorry, no posts matched your criteria.<\/p>\r\n \r\n <!-- REALLY stop The Loop. -->\r\n <?php endif; ?>\r\n \r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here is an tutorial to WordPress Loop which displays posts with it\u2019s title.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[44],"tags":[72,94,49],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>WordPress Loop - A Working Tutorial - Vishmax.com<\/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:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WordPress Loop - A Working Tutorial - Vishmax.com\" \/>\n<meta property=\"og:description\" content=\"Here is an tutorial to WordPress Loop which displays posts with it\u2019s title.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Vishmax.com\" \/>\n<meta property=\"article:published_time\" content=\"2012-02-12T13:46:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2012-05-19T13:17:40+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93\"},\"headline\":\"WordPress Loop &#8211; A Working Tutorial\",\"datePublished\":\"2012-02-12T13:46:11+00:00\",\"dateModified\":\"2012-05-19T13:17:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/\"},\"wordCount\":20,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/#organization\"},\"keywords\":[\"Code Library\",\"Web Design Tips\",\"WordPress\"],\"articleSection\":[\"Labs\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/\",\"url\":\"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/\",\"name\":\"WordPress Loop - A Working Tutorial - Vishmax.com\",\"isPartOf\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/#website\"},\"datePublished\":\"2012-02-12T13:46:11+00:00\",\"dateModified\":\"2012-05-19T13:17:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vishmax.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress Loop &#8211; A Working Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#website\",\"url\":\"https:\/\/www.vishmax.com\/en\/\",\"name\":\"Vishmax.com\",\"description\":\"Software Company in Calicut for Web Design and eCommerce\",\"publisher\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vishmax.com\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#organization\",\"name\":\"Vishmax.com\",\"url\":\"https:\/\/www.vishmax.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png\",\"contentUrl\":\"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png\",\"width\":150,\"height\":50,\"caption\":\"Vishmax.com\"},\"image\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g\",\"caption\":\"admin\"},\"url\":\"https:\/\/www.vishmax.com\/en\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WordPress Loop - A Working Tutorial - Vishmax.com","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:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"WordPress Loop - A Working Tutorial - Vishmax.com","og_description":"Here is an tutorial to WordPress Loop which displays posts with it\u2019s title.","og_url":"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/","og_site_name":"Vishmax.com","article_published_time":"2012-02-12T13:46:11+00:00","article_modified_time":"2012-05-19T13:17:40+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/#article","isPartOf":{"@id":"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/"},"author":{"name":"admin","@id":"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93"},"headline":"WordPress Loop &#8211; A Working Tutorial","datePublished":"2012-02-12T13:46:11+00:00","dateModified":"2012-05-19T13:17:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/"},"wordCount":20,"commentCount":0,"publisher":{"@id":"https:\/\/www.vishmax.com\/en\/#organization"},"keywords":["Code Library","Web Design Tips","WordPress"],"articleSection":["Labs"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/","url":"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/","name":"WordPress Loop - A Working Tutorial - Vishmax.com","isPartOf":{"@id":"https:\/\/www.vishmax.com\/en\/#website"},"datePublished":"2012-02-12T13:46:11+00:00","dateModified":"2012-05-19T13:17:40+00:00","breadcrumb":{"@id":"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vishmax.com\/en\/labs\/wordpress-loop-a-working-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vishmax.com\/en\/"},{"@type":"ListItem","position":2,"name":"WordPress Loop &#8211; A Working Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/www.vishmax.com\/en\/#website","url":"https:\/\/www.vishmax.com\/en\/","name":"Vishmax.com","description":"Software Company in Calicut for Web Design and eCommerce","publisher":{"@id":"https:\/\/www.vishmax.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vishmax.com\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vishmax.com\/en\/#organization","name":"Vishmax.com","url":"https:\/\/www.vishmax.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png","contentUrl":"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png","width":150,"height":50,"caption":"Vishmax.com"},"image":{"@id":"https:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g","caption":"admin"},"url":"https:\/\/www.vishmax.com\/en\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts\/505"}],"collection":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/comments?post=505"}],"version-history":[{"count":0,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts\/505\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/media?parent=505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/categories?post=505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/tags?post=505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}