https://websitesetup.org/how-to-speed-up-wordpress/
https://stackoverflow.com/questions/7885332/does-reading-include-files-slow-down-php-script-load
https://www.geeksforgeeks.org/lazy-loading-design-pattern/
https://medium.com/@devlob/proxy-design-pattern-to-speed-up-your-applications-2416816493d
Some OOP class with empty constructor
https://wordpress.stackexchange.com/questions/70055/best-way-to-initiate-a-class-in-a-wp-plugin
An example of instance use
/**
* Main Instance
*
* @staticvar array $instance
* @return The one true instance
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
// register it self
self::$instance = new self;
// call the method to register menu and page
self::$instance->tr_search();
}
// if instance already created just return it
return self::$instance;
}
$TrSearch = TrSearch::instance();
/**
* method to register menu on admin page and
* register needed script
*/
public function tr_search() {
// register menu page and
// page action
add_menu_page(
'Tr Search',
'Indexing Cs',
'manage_options',
'indexing-cs',
array(
$this,
'indexing_cs',
),
'dashicons-tagcloud',
'54'
);
add_action( 'wp_ajax_xAutocomplete', array( $this, 'xAutocomplete' ) );
add_action( 'wp_ajax_nopriv_xAutocomplete', array( $this, 'xAutocomplete' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'register_script' ) );
add_action( 'save_post', array( $this, 'index_single_course' ), 10, 3 );
}
https://stackoverflow.com/questions/7885332/does-reading-include-files-slow-down-php-script-load
https://www.geeksforgeeks.org/lazy-loading-design-pattern/
https://medium.com/@devlob/proxy-design-pattern-to-speed-up-your-applications-2416816493d
Some OOP class with empty constructor
https://wordpress.stackexchange.com/questions/70055/best-way-to-initiate-a-class-in-a-wp-plugin
An example of instance use
/**
* Main Instance
*
* @staticvar array $instance
* @return The one true instance
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
// register it self
self::$instance = new self;
// call the method to register menu and page
self::$instance->tr_search();
}
// if instance already created just return it
return self::$instance;
}
$TrSearch = TrSearch::instance();
/**
* method to register menu on admin page and
* register needed script
*/
public function tr_search() {
// register menu page and
// page action
add_menu_page(
'Tr Search',
'Indexing Cs',
'manage_options',
'indexing-cs',
array(
$this,
'indexing_cs',
),
'dashicons-tagcloud',
'54'
);
add_action( 'wp_ajax_xAutocomplete', array( $this, 'xAutocomplete' ) );
add_action( 'wp_ajax_nopriv_xAutocomplete', array( $this, 'xAutocomplete' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'register_script' ) );
add_action( 'save_post', array( $this, 'index_single_course' ), 10, 3 );
}
Comments
Post a Comment