Module



  • Good day!

    Can you tell me who made a crypt like a module to the site? I want, for example, to open mysite.com/myplugin/to the public, some internal plastic page. Maybe someone has examples of how to do that?

    Thank you!



  • You're building a page. myplugin.phpyou put it in the root of a plastic folder. The next fragment of the code makes it possible to verify whether the page with that name is being used, and if so, uses the template.

    add_filter( 'template_include', 'template_include_function', 1 );
    

    function template_include_function( $template_path ) {
    if(is_page('myplugin')){
    $template_path = plugin_dir_path( FILE ) . '/myplugin.php';
    }
    return $template_path;
    }


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2