Skip to content

And then instantiate the appropriate class to the template to be loaded.(Use Autoloader)

License

Notifications You must be signed in to change notification settings

p-o-t-s/wpsb-class-selector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

wpsb-class-selector

And then instantiate the appropriate class to the template to be loaded. (Use Autoloader)

example(setup after Autoloader)

require './WPsB_Class_Selector.php';

$args = array(
    'prefix' => "WPsB",
    'suffix' => "Controller",
    'store_name' => 'my_controller'
);

$WPsB_Class_Selector = new WPsB_Class_Selector($args);
$WPsB_Class_Selector->register();

post type is post, template single.php, WPsB_Single_Post_Controller instance is stored in the set_query_var($args['store_name'])

in theme template,

$my_data = get_query_var( 'my_controller' );


echo esc_html( $my_data->foo );

feature

  • getter/setter static function
  • Corresponding to the attachment', paged, comment_popup`
  • The name of the class should always be set in the snake case

About

And then instantiate the appropriate class to the template to be loaded.(Use Autoloader)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages