{"id":87328,"date":"2012-07-17T13:00:48","date_gmt":"2012-07-17T17:00:48","guid":{"rendered":"http:\/\/wpmu.org\/?p=87328"},"modified":"2012-07-16T22:49:40","modified_gmt":"2012-07-17T02:49:40","slug":"code-snippets-for-supercharged-wordpress-pages","status":"publish","type":"post","link":"https:\/\/wpmudev.com\/blog\/code-snippets-for-supercharged-wordpress-pages\/","title":{"rendered":"Supercharged Pages: 5 Code Snippets for Powerful WordPress Pages"},"content":{"rendered":"<p>Pages are one of the defining features of WordPress. Not just because they are different from Posts, which are category and tag based, but also because you can feature a Page as your sites front page. With the added functionality that templates provide, the sky (metaphorically speaking) has become the limit for theme designers and developers.<\/p>\n<p>Here are five code snippets you can use to enhance what you can do with a Page!<\/p>\n<p>\u2014<\/p>\n<p>1. <strong><a href=\"http:\/\/snipplr.com\/view\/64115\/show-specific-wordpress-postpage\/\" target=\"_blank\">Show specific WordPress Post\/Page<\/a>:<\/strong> Code used to get the content, title, excerpt, etc for a specific Page or Post. This code is perfect for showing specific content on a Page template.<\/p>\n<p>2. <strong><a href=\"http:\/\/snipplr.com\/view\/65702\/wordpress-get-attachements-for-post-or-page\/\" target=\"_blank\">WordPress get attachements for Post or Page<\/a><\/strong>: Gets a Post or Page&#8217;s attached images and outputs them. A nice piece of code to show a gallery of thumbnails perhaps.<\/p>\n<p>3. <strong><a href=\"http:\/\/snipplr.com\/view\/55169\/list-wordpress-subpages\/\" target=\"_blank\">List WordPress sub Pages<\/a><\/strong>: As the description states, you can use this code snippet in your template file to show all sub Pages for a particular Page. Example uses may include a list of employees by job, where each employee is a sub Page of a department.<\/p>\n<p>4. <strong><a href=\"http:\/\/css-tricks.com\/snippets\/wordpress\/if-page-is-parent-or-child\/\" target=\"_blank\">If Page is Parent or Child<\/a><\/strong>: May sound a bit complex, but actually it&#8217;s a handy little piece of code. Check out the example provided by Chris and how it works.<\/p>\n<p>5. <a href=\"http:\/\/wp-snippets.com\/create-a-new-page\/\" target=\"_blank\"><strong>Create a New Page<\/strong><\/a>: No, this is not done with the &#8220;Add New&#8221; button. Rather, this is done by a themes functions.php file. Generally used to create pages where specific content would need to be filled in. You&#8217;ll also find this being used by e-commerce plugins to create new Pages for their cart, checkout etc&#8230;<\/p>\n<p>\u2014<\/p>\n<p>Got any <a title=\"WordPress Code Snippets: Keep them Organized with this Plugin!\" href=\"https:\/\/wpmudev.com\/blog\/wordpress-code-snippets\/\" target=\"_blank\">code tricks<\/a> of your own up your sleeve? Share them with us, leave a comment below!<\/p>\n<p><em>Image by <a href=\"http:\/\/www.flickr.com\/photos\/9918311@N02\/4268587808\/\" target=\"_blank\">sociotard<\/a><\/em><\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Take your WordPress Pages to new levels with code snippets designed to help you do awesome things!<\/p>\n","protected":false},"author":42744,"featured_media":87335,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"blog_reading_time":"","wds_primary_category":0,"wds_primary_tutorials_categories":0,"footnotes":""},"categories":[34],"tags":[390,778,655],"tutorials_categories":[],"class_list":["post-87328","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-themes","tag-code","tag-functions","tag-pages"],"_links":{"self":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/87328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/users\/42744"}],"replies":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/comments?post=87328"}],"version-history":[{"count":2,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/87328\/revisions"}],"predecessor-version":[{"id":216613,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/posts\/87328\/revisions\/216613"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media\/87335"}],"wp:attachment":[{"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/media?parent=87328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/categories?post=87328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tags?post=87328"},{"taxonomy":"tutorials_categories","embeddable":true,"href":"https:\/\/wpmudev.com\/blog\/wp-json\/wp\/v2\/tutorials_categories?post=87328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}