{"id":6034,"date":"2023-09-07T02:43:48","date_gmt":"2023-09-06T23:43:48","guid":{"rendered":"https:\/\/fspirits.com\/how-do-i-create-a-custom-archive-page-in-wordpress\/"},"modified":"2023-09-07T02:43:48","modified_gmt":"2023-09-06T23:43:48","slug":"how-do-i-create-a-custom-archive-page-in-wordpress","status":"publish","type":"post","link":"https:\/\/fspirits.com\/es\/how-do-i-create-a-custom-archive-page-in-wordpress\/","title":{"rendered":"How do I create a custom archive page in WordPress?"},"content":{"rendered":"<br \/>\n<h2> Qu\u00e9 <a  class=\"btl_autolink_hyperlink\"  href=\"https:\/\/fspirits.com\/go\/worldpress-it\/\"   >plugins<\/a> are available to help create \u2062a custom archive page \u2062in WordPress<\/h2>\n<h1>How do I create a custom archive page in WordPress?<\/h1>\n<p>Creating a\u2063 custom archive page in WordPress is a \u200dgreat way to organize and display your content in a unique and attractive way. Whether you\u2019re looking to create\u2063 a portfolio\u2062 page, a blog page, or a \u2062custom page for a specific category, a custom archive page can help you do \u2062it.<\/p>\n<h2>Step 1: Create a New Page Template<\/h2>\n<p>The first step \u2064to creating \u200ca custom archive\u2063 page in WordPress \u2062is to create a new page template.\u200c This template will be used to display the content you want to include in your archive page.\u200d To create a new page template, open your WordPress dashboard and navigate to Appearance > <a  class=\"btl_autolink_hyperlink\"  href=\"https:\/\/fspirits.com\/go\/worldpress-it\/\"   >Tema<\/a> Editor.\u2064 From there, select the \u201cPage Templates\u201d folder and click \u201cAdd New\u201d.<\/p>\n<h2>Step 2:\u2064 Add the Code for Your\u200d Custom \u200dArchive Page<\/h2>\n<p>Once you\u2019ve created\u200d your new page template, you\u2019ll need\u200c to add the code for your custom archive page. This code \u200cwill tell WordPress how to display the content you want to \u2064include in \u2063your archive page. To do this, open your page template and\u200c paste the following code into the editor:<\/p>\n<p><?php<br \/>\n\/*<br \/>\nTemplate Name: Custom Archive Page<br \/>\n*\/<\/p>\n<p>get_header();<br \/>\n?><\/p>\n<div id=\"primary\" class=\"content-area\">\n\t<main id=\"main\" class=\"site-main\"><\/p>\n<p>\t\t<?php<br \/>\n\t\t\/\/ The Query<br \/>\n\t\t$the_query = new WP_Query( array(<br \/>\n\t\t\t&#8216;post_type&#8217; =>\u2062 &#8216;post&#8217;,<br \/>\n\t\t\t&#8216;posts_per_page&#8217; =>\u200d -1,<br \/>\n\t\t\t&#8216;orderby&#8217; => &#8216;date&#8217;,<br \/>\n\t\t\t&#8216;order&#8217; => &#8216;DESC&#8217;,<br \/>\n\t\t) );<\/p>\n<p>\t\t\/\/ The\u2062 Loop<br \/>\n\t\tif ( $the_query->have_posts() ) {<br \/>\n\t\t\techo &#8216;<\/p>\n<ul>&#8216;;<br \/>\n\t\t\twhile ( $the_query->have_posts() ) {<br \/>\n\t\t\t\t$the_query->the_post();<br \/>\n\t\t\t\techo &#8216;<\/p>\n<li><a href=\"' . get_permalink() . '\">&#8216; . get_the_title() . &#8216;<\/a><\/li>\n<p>&#8216;;<br \/>\n\t\t\t}<br \/>\n\t\t\techo\u2063 &#8216;<\/ul>\n<p>&#8216;;<br \/>\n\t\t\t\/* Restore original Post Data *\/<br \/>\n\t\t\twp_reset_postdata();<br \/>\n\t\t} else {<br \/>\n\t\t\t\/\/ no posts found<br \/>\n\t\t}<br \/>\n\t\t?><br \/>\n\t<\/main><!-- #main -->\n<\/div>\n<p><!-- #primary --><\/p>\n<p><?php<br \/>\nget_footer();<br \/>\n?><\/p>\n<p>This code will display\u2063 a list of all your posts in reverse chronological order. You can customize this code to display different types of content, such as pages, custom post types, or specific categories.<\/p>\n<h2>Step 3:\u2063 Add the Template to \u200dYour Page<\/h2>\n<p>Once you\u2019ve \u2064added the code for your custom\u200d archive page, you\u2019ll need\u200c to\u2064 add the template to your\u2062 page.\u2062 To do this, open the page\u2063 you want to add the template to and select the \u201cPage Attributes\u201d tab.\u2064 From there, select the template you created in Step 1 from the \u201cTemplate\u201d dropdown menu.<\/p>\n<h2>Step\u2062 4: Customize Your Archive Page<\/h2>\n<p>The \u2062last step \u200dis to customize your archive page. You can do this by adding custom CSS to your page template or by using a <a  class=\"btl_autolink_hyperlink\"  href=\"https:\/\/fspirits.com\/go\/worldpress-it\/\"   >plugin<\/a> such as Advanced Custom Fields. This <a  class=\"btl_autolink_hyperlink\"  href=\"https:\/\/fspirits.com\/go\/worldpress-it\/\"   >plugin<\/a> allows you to add custom fields\u2064 to\u2064 your page, such as a featured image, a description, and \u2063more.<\/p>\n<h2>Conclusi\u00f3n<\/h2>\n<p>Creating a custom archive page\u2062 in WordPress is\u2064 a great\u200c way to organize and display\u200b your content in a unique and attractive\u2062 way. With a few simple steps, you can create \u200ca custom page\u2062 template and add it to your page. You can\u2064 then customize your archive page \u200dwith \u200bcustom CSS or a \u200b<a  class=\"btl_autolink_hyperlink\"  href=\"https:\/\/fspirits.com\/go\/worldpress-it\/\"   >plugin<\/a> such as Advanced Custom Fields.<\/p>\n<p>If you need help with any small or big project, Free Spirits www.freespirits.gr and \u2062www.fspirits.com can help. <\/p>","protected":false},"excerpt":{"rendered":"<p>What <a  class=\"btl_autolink_hyperlink\"  href=\"https:\/\/fspirits.com\/go\/worldpress-it\"   >plugins<\/a> are available to help create \u2062a custom archive page \u2062in WordPress How do I create a custom archive page in WordPress? Creating a\u2063 custom archive page in WordPress is a \u200dgreat way to organize and display your content in a unique and attractive way. Whether you\u2019re looking to create\u2063 a portfolio\u2062 page, a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6035,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[580],"tags":[581,733,1462,703],"class_list":["post-6034","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-wordpress","tag-create","tag-custom-archive-page","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/fspirits.com\/es\/wp-json\/wp\/v2\/posts\/6034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fspirits.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fspirits.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fspirits.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fspirits.com\/es\/wp-json\/wp\/v2\/comments?post=6034"}],"version-history":[{"count":0,"href":"https:\/\/fspirits.com\/es\/wp-json\/wp\/v2\/posts\/6034\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fspirits.com\/es\/wp-json\/wp\/v2\/media\/6035"}],"wp:attachment":[{"href":"https:\/\/fspirits.com\/es\/wp-json\/wp\/v2\/media?parent=6034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fspirits.com\/es\/wp-json\/wp\/v2\/categories?post=6034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fspirits.com\/es\/wp-json\/wp\/v2\/tags?post=6034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}