What is action to show plugin page
-
When I develop a plugin, usually I need frontend page for him. I do the following:
add_action ( 'the_content', 'myCatchFunction'); function myCatchFunction($content) { $slug = 'myslug'; if (get_post(get_the_ID())->post_name == $slug) { //do action } }
and for the custom post types:
add_filter( 'template_include', 'myCatchFunction', 1 ); function myCatchFunction( $template_path ) { $slug = 'post_type_slug'; if ( get_post_type() == $slug ) { //do action } }
When I use first method, I need to create a page, and this is not good, because if I disactivate a module, I need to disactivate a page too.
Is this is the one solution or there is another method without page creating?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘What is action to show plugin page’ is closed to new replies.