There is a dirty (actually dirty as hell) way to attach a ordinary WordPress page as archive page from a custom post type settings page.
You need to unregister post type first, and create again. If you don’t use custom arguments or if you brave enough try this code.
Add this code fragment end of your settings page.
if(isset($_GET['settings-updated']) && $_GET['settings-updated'] == true){
//Dirty as hell
$esettings = get_option ( "events_settings_options" );
$getslug = get_post_field('post_name',$esettings['events_page']);
unregister_post_type('events');
register_post_type('events',array(
'public' => true,
'rewrite' => array('slug'=>'events'),
'has_archive' => $getslug,
));
//Needed for automated rewrite rules
flush_rewrite_rules();
//To test the functionality
echo get_post_type_archive_link( 'events' );
}
Related Posts:
- Add Settings to Custom Post Type
- Custom taxonomy template not working with simple loop. Multiple CPT using the same taxonomy
- WordPress custom post type archive with description
- Custom post type is showing custom home page, not archive page
- Custom post type archive page blank
- My archive-posttype.php template is not loading
- Custom Post Archive is not working
- How to integrate single and archive templates for custom post type in any WordPress theme
- Custom Post Type Archive template not being called
- Is possible register two archive pages for single custom post type?
- Archive page of CPT’s custom Taxonomy
- Finding the CPT archive template source
- ACF Pro Accessing fields on a Custom Post Type
- get first limited words from a custom post in the archive page
- Show index and not the archive for “Dog Custom Post” with default slug
- Custom post type archive page not showing on archive-posttype.php
- Custom post type with two templates
- How do I make my archive page look like popular reviewing sites (e.g., Polygon and Gamespot) [closed]
- Display custom post type archive on page.php template
- Making a archive gallery page for a custom post type which already has an archive page
- Pagination not working only on Archive-Name.php using new WP_Query
- Can’t add custom post type archive page to menu
- WordPress CPT archive page display sticky post first and then display the rest of the posts in same Query
- Which Template Page Should I Use?
- How to hyperlink content from archive page with custom post-type
- Display custom post types in wp_list_pages
- Set thumbnail and title for a post type archive (not post itself!)
- How to set up Custom Post Type archive page as Front page
- Url to archive page for custom post type
- How can I use archive-{post_type}.php theme template?
- How to display CPT archives?
- Save and user submitted data from a form and display them in the wp backend
- Custom meta Title for custom post type archive from page
- Excluding a Custom Post Type with a specific tag using pre_get_posts
- Pagination doesn’t function properly for archive of a custom post type set as the front page
- How to group navigation items in the admin panel
- Return the name of the post type
- Conflict between Capabilities and Menu Visibility with Custom Post Types
- current-menu-item not added on page showing custom post type (rendered with archive template)
- Alphabetically sort a taxonomy.php template by post title
- Custom Permalinks For CPT and pages with parent. Advanced WordPress
- Permalink problems with custom post type and custom taxonomy
- sort CPT on Custom Taxonomy Archive page
- Getting post attchment URL to populate a CPT Admin Page Column
- Using menu_position to add two entries between Dashboard and Posts
- ACF for custom post type archive pages: which hook to use?
- Use the custom post type archive for taxonomies?
- How to add query args to links to CPT admin submenu
- Custom post type permalink uses archive page to display posts
- Custom Post type date archive for custom taxonomy
- Show categories of custom post type and not all posts
- Taxonomy template page not working
- CPT Archive pre_get_posts not working?
- Reusable metabox backend and frontend
- adding custom post type “name” to single template
- CPT with its own category and tag url
- Removed custom post type archive page shows blog page
- Custom Post Type with Configurable Sidebar via ACF
- Can’t replace the default sidebar with a custom sidebar on Custom Post Type in Genesis
- Multiple custom post types showing up in edit.php
- Query Posts that have Custom Taxonomy
- Top level menu position overwrites another entry
- Plain links in single-class.php and archive-class.php not working
- admin_head-post.php only works after publish / update
- Custom Post Type Custom Archive Page Not Working
- Getting custom taxonomy posts on archive page
- add_action ‘init’ from inside a class for custom post types
- Archive page for custom post type and custom taxonomy
- Custom post type archive – error in nav-menu-template.php
- Order Custom Post Type Archive by multiple values in functions.php
- Custom post type category permalinks and archive pages
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- Pagination does not work on Custom Post Type archive while trying to get load more function working
- CPT archive page – show one post from each taxonomy term
- How do I override the default number of items to be listed on an archive.php page? [duplicate]
- adding page types in menu
- Get single posts archive information
- How to have multiple archive pages?
- Displaying custom taxonomy menu in custom post type archive
- Create a Custom Path to Archive
- Custom Post Type Date Based Archive URL rewrite [duplicate]
- Best way for a plugin to define a custom post type archive template?
- Specifying a template for custom post type pages
- WordPress sitemap with Custom Post Types
- Pages not appearing?
- Metaboxes inside Tab
- CPT archive with WP native/core tax/categories
- How to set a ‘page’ as parent of a custom post type?
- Display All Courses in Course Archive Page
- Getting Same Description in All the Custom Taxonomy Posts
- Pagination links for custom post type shows correct number of links, but links result in Page not found
- Invalid content when I try to import custom post type from the old template wordpress
- Archive page for WordPress Custom Post Type doesn’t show pagination from paginate_links()
- 2 Custom Post Types In 1 Archive Page?
- Custom post type archive URLs with a single taxonomy
- Different number posts per page based on custom post type term id
- Restrict admin pages for specific user role
- Does this archive template part look like its making too many calls to the db?
- How to add specific terms in a custom post type?
- Cannot include custom post item within a menu