You have misunderstand the purpose of add_submenu_page and it’s callback function.
If you take a look at WordPress Codex you will see that the purpose of this function , in your case the slides_page function, is to output the content of the page. ie output HTML code etc
$function
(callback) (optional) The function to be called to output the content for this page.
Default:
http://codex.wordpress.org/Function_Reference/add_submenu_page
You have to separate the presentation from the logic of your plugin.
You can register your custom posts when the user activates the plugin using the register_activation_hook
hook.
Related Posts:
- Tips for using WordPress as a CMS? [closed]
- Adding a Taxonomy Filter to Admin List for a Custom Post Type?
- Custom Post Type Templates from Plugin Folder?
- Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
- Implementing a CrunchBase.com Clone using WordPress?
- Custom media upload content for inserting custom post shortcode
- How to Add a Third Level Sub Menu to the WordPress Admin Menu
- Redesigning Custom Post Type “Add New” page
- How to Remove Certain Screen Options and Meta Boxes from add/edit post type?
- How to share category taxonomy with custom post type (The Event Calendar plugin)
- Is it possible to define a template for a custom post type within a plugin independent of the active theme?
- How to get a variable number of posts per post type on the main loop?
- Admin menu as submenu from another plugin
- WP_query parameters for date range
- Creating a WordPress admin page without a menu for a plugin
- Use a plugin to handle custom post types?
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- Removing an admin page added by a 3rd party plugin. Gravity forms in this example
- Creating a default Custom Post Template that a Theme can override
- Delete option doesn’t appear for plugins
- Adding an admin page – OOP approach not working
- Jetpack plugin (ShareDaddy): Prevent share buttons showing on custom post types?
- Show custom taxonomy not in submenu
- Plugin option for input box validation
- Calling an custom field from theme option at the frontend
- Array to string conversion error when trying to POST multidimensional array
- Hide some portion on single.php base on author
- How to add submenu to WordPress plugin in the same Directory of main Plugin?
- Creating themes using the one Plugin (Toolkit)
- Displaying image from a repeatable group
- How to add jquery to my custom post type wp plugin
- WordPress list child pages of custom post type
- WordPress custom posttype meta values doesnot save
- CPT-onomies CPT_TAXONOMY->get_terms extremely slow with 6K posts
- How can I pass value to function in add_menu_page?
- Getting 404 page not found error while trying to access add new plugin / themes
- get recent 12 days post then random in wordpress
- making a glossary with wordpress
- Plugin menu replaced by another plugin?
- Create custom fields on a post
- Custom Post type plugin breaking the front page shows dashboard?
- What method should I use for a sidebar widget that reads latest posts?
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- Insert data in custom table during new post creation
- get_option include in my adsense
- WordPress Custom post type won’t save properly
- Top Contributors Plugin with Custom Post Type
- How can i do custom author list?
- Making a Custom Post Type Publish Loop
- featured image problem with custom post type
- How can I default a new post to being saved?
- WordPress User Frontend Editing Custom Fields
- How to list the categories by custom taxonomy created?
- Is a custom post type considred a plugin?
- Remove base from the custom post type URL [duplicate]
- Is an Office a custom post type [closed]
- Make a magic tag work with Custom Post Types
- Change the behaviour of archive cpt category and single cpt by plugin, not by theme
- Plugin link does not appear in my toolbar
- A plugin for software reviews site like this one?
- Snippet displaying LearnDash parent course title with lesson title [closed]
- How to laod wp_enqueue_style to another header i created my self
- Display Custom Post Type and Custom Taxonomy Data on Front End Using Only a Plugin
- Looking for a plugins for organization portal (Staff, Units, Departments)? [closed]
- WordPress show different custom post type
- Filter custom post type returned from REST api
- Links not opening as they should. Custom WP plugin
- Wrong block appender button showing
- Select posts from list and add them in a new list
- jet engine listing for every single taxonomy in post type [closed]
- How to export post tags from wordpress
- Failed to update a post when I add a taxonomy to it
- How to access the page without registering in wordpress
- CPT template is not being automatically used single post pages
- admin_enqueue_scripts using hook_suffix vs GET page
- How to make content as required in custom post type?
- Set the title of a custom post automatically by using info from custom fields?
- Submitting form to admin-post.php WordPress
- public custom posts not showing in my wordpress plugin
- plugin translation *.mo file not getting loaded for custom post
- How to provide page_template path in custom plugin using WordPress
- Create CPT on Ajax Call
- How to add CPT in Elementor pro search template
- how to compare date meta value in jet smart filter Date query?
- My site has only one page, and users access my uploaded mp3 files from there – can I analyze access by song title?
- Tickera missing attendees – No attendees found
- Include theme header and footer in custom plugin
- How to fetch WordPress Gallery Images to a Custom Post Type?
- Remove custom menu pages for admin users
- Disable All In One SEO plugin for custom post type
- How to disallow users to edit other’s posts for a new custom post type?
- Remove H1 title in admin post edit screen
- How to include Font Awesome icons into ‘menu_icon’ from register_post_type() function – wp admin?
- PHP Fatal error: Cannot redeclare distance() when making a new block
- How to check if the post exists in any of the categories?
- How do I know if an archive correspond to a custom post type taxonomy?
- Keep the expansible tree (list of posts) open in the sidebar
- How to Display News in a Timeline with Headline, Category, and Time?
- Load a custom post type template.html from a plugin
- Query Custom Post Types on Available Dates