mercredi 10 février 2016

how do I tie url to a plugin action and view in a wordpress plugin

Currently I understand how to do this using shortcodes and manually creating pages :-

function myplugin_details_page_html() {
        ob_start();
       require('includes/views/details.php');
       $html =  ob_get_clean(); 
       echo $html;
     }

function myplugin_signup_page_html() {
        ob_start();
        require('includes/views/signup.php');
        $html =  ob_get_clean();    
        echo $html;
        }


 add_shortcode( 'myplugin_details', 'myplugin_details_page_html' );

 add_shortcode( 'myplugin_signup', 'myplugin_signup_page_html' );
 //create pages in admin or via  wp_insert_post();

But I really want to do is tie pages to the function actions without having the pages created with shortcodes inserted and edited or editable in the wp admin backend.

How can I attache the url format to views such that

http://ift.tt/20MkZs4 matches to my plugin function myplugin_details_page_html()

and

http://ift.tt/1PDIuch matches to my plugin function myplugin_signup_page_html()

Where the pages are rendered dynamically without creating pages and using shortcodes?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire