4
votes

I'm developing a plugin for wordpress. This plugin has to have an admin section for plugin set up but also has to have a custom front end page with forms.

I'm new into the wordpress plugin development world but I have not found specific information for this task.

Is there a way to add pages to front end from a plugin or is necessary to manually edit the current template and add the page?

2

2 Answers

0
votes

I think you looking for this for the admin settings page https://codex.wordpress.org/Function_Reference/add_options_page

Fot the front end, i would recommend to create a page with a template https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/

0
votes

Here is a way to add custom content on a front-end page when you create your plugin: http://blog.frontendfactory.com/how-to-create-front-end-page-from-your-wordpress-plugin/

function elegance_referal_init()
{
    if(is_page('share')){   
        $dir = plugin_dir_path( __FILE__ );
        include($dir."frontend-form.php");
        die();
    }
}

add_action( 'wp', 'elegance_referal_init' );