Getting Plugin to read all script files

Plugins, like any other functions file in a theme are just extensions to your theme’s functions.php file. Any file that extends the main functions.php has to be manually included into the main functions file. The reason for this is, only files and templates within WordPress file structure gets auto laoded. There is no logic to … Read more

How to get html tag ids from template?

WordPress doesn’t operate with DOM for the purpose of page source generation from templates. Templates are treated and run as PHP source files, producing any and all output. Unless you have control over actual templates your options likely are: Attempting to buffer and rewrite output (rather fragile, more so for publicly released plugin) Adjust markup … Read more

auto create only 1 wp page in activate custom plugin

register_activation_hook( __FILE__ , ‘my_plugin_install’); function my_plugin_install() { global $wpdb; $the_page_title=”Book”; $the_page_name=”book”; // the menu entry… delete_option(“my_plugin_page_title”); add_option(“my_plugin_page_title”, $the_page_title, ”, ‘yes’); // the slug… delete_option(“my_plugin_page_name”); add_option(“my_plugin_page_name”, $the_page_name, ”, ‘yes’); // the id… delete_option(“my_plugin_page_id”); add_option(“my_plugin_page_id”, ‘0’, ”, ‘yes’); $the_page = get_page_by_title( $the_page_title ); if ( ! $the_page ) { // Create post object $_p = array(); $_p[‘post_title’] … Read more