I would suggest first adding a new file called
archive-beach_clean.php
to your themes root directory.
Then copy and paste all the code from that index file into it.
After, if you haven’t done so already, add this argument, 'has_archive' => true
, to the arguments array used in the register_post_type function and in the same array make sure rewrite
isn’t set to false.
Then go to the wordpress admin area Settings->Permanlinks and make sure Post name is selected and click Save (this will flush your permalinks in case the post type wasn’t registered already, now it will be).
Finally, you will be able to access your new page here http://your_domain.com/beach_clean
If you want to change the slug to something other than beach_clean
, add the rewrite
argument in as noted above, and make the value of it is array('slug' => 'your-custom-slug')
Related Posts:
- Very Slow Page – How to Optimize # of Queries?
- How to make sure content doesn’t display if selection is empty
- How can I group posts by months and years?
- Loop increase number
- foreach loop inside the loop creating duplicates in output
- Page that lists publications by classifying them by taxonomy
- WordPress loop add heading before first of type
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Strange behavior on WP_query
- get_post_meta for Custom Post Type ( CPT )
- Query Custom Post Type by Tag
- WP_Query search posts by custom post type and custom taxonomy
- Why does using WP_Query inside a shortcode in an elementor page cause the arguments for WP_Query to get malformed?
- Unable to get post content from custom post type loop
- Lists Posts from CPT that match the Title of the Page
- Help Structuring Query for Archive Pages
- Display custom field of specific post where post title matches variable
- Conditional to modify query results
- Loop on front-page.php
- wp_query to find posts by year and month
- WP_Query is printing out only one post when posts_per_page is set to multiple
- WP Query to displaying date and posts for that date?
- Create a random unique 6 digit number as custom field for custom post type
- Remove duplicated values from a loop
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Custom Post Type Loop within Shortcode
- Can’t get order_by meta_value_num to work properly
- WP_Query | ‘post_type’ doesn’t work
- How to connect two custom post types with nested loops
- Filter by custom taxonomy slug on a custom post type
- Query custom post type in the loop
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Loop through Custom Post Type, and then show children within each iteration
- Can I create a loop with multiple post types and specify different $args for each post type?
- Display CPT posts based on specific taxonomy
- WP_Query orderby modified to include custom meta changes
- Custom Post Type Loop throws 500 error when used in widget
- Show one item per category of a custom post type
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- CPT + CMB2: data not displaying for only first post in loop
- How do i calculate the total of values of custom fields in custom post types?
- Custom loop with multiple taxonomy queries
- I would like to have different styles for my posts based on the content of each post
- Checking if Post Title is Unique as Loop Criteria
- Custom Tag Description unable to display just below and outside of the Loop
- creat filter with wp_query
- What’s the WP way to load remaining custom posts?
- WP Query with categories only shows one post and ignores the category
- Problem: wp_query outputs all images on site
- Configuring a meta query with multiple post types that have the same relationship on a single page
- How to fetch posts that are stored in the different table than (default) wp_posts?
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- How do I list a custom field and custom taxonomies for each result in a loop?
- Custom Post Type Query W/Category Dropdown
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- How can I increase the post count for custom post types only?
- Custom post type pagination error
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- Show the categories the current post has
- What is the most efficient way to execute recursive complex queries?
- Fetch data from two custom post types and create multidimensional array for output to html table
- CPT loop doesn’t seem to account for post date?
- posts_per_page in custom WP_Query does not override “Reading” settings?
- set object terms after some some time of published post – functions.php
- Alike Shortcode using in Custom Shortcode
- Query custom post type that has a serialized relational advanced custom field value
- Exclude a specific post in a Custom Post Type
- Pin posts to top of custom loop
- Pagination not working in custom post type. Help
- Sort custom post column by generated value?
- Filtering posts based on three taxonomies
- Pagination Not Working When Used With WP_Query() `offset` Property
- when looping through custom post data not appearing
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- WP_Query – How To Query Only Custom Posts With No Children of Their Own?
- wp_post_delete is deleting all offices
- SEARCH QUERIES – REVERSE OUTPUT
- Accessing download link from the loop with WP Download Manager Pro
- Custom Post Type has wrong label and is not found when called by a loop
- Combine multiple separate lists into one
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- Error in the page of a CPT file in WordPress
- Looping to organize and display custom posts by category using PHP and WordPress
- Tell wordpress to show a single page instead of an archive page
- post_type incorrect for custom post type
- Search result based on URL
- Staggering featured post using ‘sticky’
- Wrapping an unknown amount of posts inside separate HTML Containers during WP_Query loop
- Show parent category and subcategory once in while loop
- subtracting the current post form then whole loop, which is generating all CPT titles
- Custom Taxonomy – fields
- Custom Post By Category
- Mix Facebook and Twitter feed into custom posts
- WordPress trying to query two custom types to get child from the parent
- sorting in wp query based on custom field value
- Custom post Query and WordPress Post Query Clash
- How to get the posts that my following users are liked?
- Add active class to foundation 6 tabs while looping categories
- CPT post doesnt shows tags and category on backend admin page