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
- Meta Boxes: ‘admin_init’ or ‘add_meta_boxes’ hook?
- How to get the custom post type from an archive page?
- Page Template as Custom Post Type Archive
- Can’t get post id on page that is a custom post type archive
- Can I have Post Types under other Post Types in Admin menu?
- Add Post type menu to another menu
- How do I create multiple post types in same menu section in WP-admin?
- Get monthly archives for custom post type
- Is it possible to remove the posts_per_page limit on a specific post type?
- Is it possible to have an index page for taxonomy term for each custom post type it is assigned to?
- Assign Page Template Within A Custom Post Type
- Posts per Page on custom Taxonomy Template
- Post type archive page not working
- Custom Post Type – Archive page title
- Possible to add another setting to ‘Front page displays’ setting for Custom Post Type
- Archive or taxonomy pages not working for custom post type
- How to add new tab to admin list of posts and handle result list
- taxonomy template for custom post type the same as the archive
- Loop that displays the first post of every available custom post type?
- Trying to add script to specific admin page is not working
- Specify a Page as the parent to the CPT Archive
- Custom template won’t load for a custom post type (custom permalinks used)
- Move custom post menu to under plugin admin menu
- Unable to get post archive link
- CPT custom archive template does not get loaded
- Am I using the flush_rewrite_rules function in the right place?
- Custom Post Type archive loop separated by term, in specific term order
- Show only posts from one category on custom post type archive page
- How should I structure my post types?
- Isotope Filtering with Bootstrap Tabs – Custom Post Type Query Loop in each Tab (Have to click twice to filter)
- Display custom post type category, while in a CPT category, then the posts beneath
- Number of Custom Post Types published are not being shown in the custom page
- Possibilities for the edit.php admin panel? [closed]
- Custom Post Type Archive URL is wrong
- Canonical url differs from custom post type archive URLs
- Custom post type archive pagination 404
- Ignoring slug capitalization on rewrite rule for custom post type archive page
- Custom post type archive with page as parent url
- Custom post type, global categories — what’s the template name?
- Url to archive page for custom post type
- How can I use archive-{post_type}.php theme template?
- Custom meta Title for custom post type archive from page
- Return the name of the post type
- Conflict between Capabilities and Menu Visibility with Custom Post Types
- Alphabetically sort a taxonomy.php template by post title
- Getting post attchment URL to populate a CPT Admin Page Column
- Using menu_position to add two entries between Dashboard and Posts
- adding custom post type “name” to single template
- CPT with its own category and tag url
- Can’t replace the default sidebar with a custom sidebar on Custom Post Type in Genesis
- Custom Post Type Custom Archive Page Not Working
- Getting custom taxonomy posts on archive page
- Displaying custom taxonomy menu in custom post type archive
- Cannot include custom post item within a menu
- Static Front Page not working for custom theme
- Display Custom Post Type Archive content with Shortcode
- Multiple Custom Post Type in Taxonomy Archive Causing White Screen
- Subset of Custom Post Type From Admin Menu Based on Meta Data
- Building Link List for Custom Tax
- Only show categories that have posts within custom post type
- Meta_query by date for Events archive
- How to Show all Values in category.php page using post_type
- Duplicate “Pages” Item in Admin Menu
- Custom taxonomy in custom post type archive with pagination
- Templates list in “Page Attributes” metabox is inaccurate
- Stop Custom post type from being searched via URL
- How to avoid hardcoded text in a custom page template?
- Archive templates based on taxonomies
- title tag for custom post type remove taxonomy name from title tag
- How can I retrieve the slug for a custom post type via name?
- Two different archive pages showing the same content
- Pagination not working for archive
- wordpress custom post type shows other cpt posts in admin menu
- Add a class to a menu item depending on a body class
- Pagination not working on custom post type archive
- Best practice to display a list/archive of Custom Posts in a Page Template
- Archive pagination – second page shows exactly the same posts