We can add Script, Style, Navigation Menu & Shortcode using wordpress functions.

Examples

/*Add Script*/

add_action( ‘wp_enqueue_scripts’, ‘frontend_scripts’ );
function frontend_scripts(){
wp_register_script( ‘my_script’, ‘//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js’, array( ‘jquery’ ));
wp_enqueue_script( ‘my_script’ );
}

/*Add Style*/

add_action( ‘wp_enqueue_style’, ‘frontend_style’ );
function frontend_syle(){
wp_enqueue_style(‘bootstrap-astyle’, plugins_url() .’/’.’post-search/css/style.css’);
wp_enqueue_style(‘font-awesome’, ‘//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css’);
}

/*Add Navigaton Menu*/

add_action(‘admin_menu’, ‘my_gallery’);
function my_gallery()
{
add_menu_page( ‘Gallery’, ‘Gallery’, ‘edit_gallery’, ‘gal_page’, ‘gallery_page’, ”, 24);
add_submenu_page( ‘gal_page’,’Add Gallery’, ‘Add Gallery’, ‘edit_posts’, ‘add_gallery’, ‘add_gallery’,”,1);
add_submenu_page( ‘gal_page’,’View Gallery’, ‘View Gallery’, ‘edit_posts’, ‘gallery_list’, ‘gallery_list’,”,2);
add_submenu_page( ‘gal_page’,’Gallery’, ‘Uninstall’, ‘edit_posts’, ‘uninstall’, ‘uninstall’,”,3);
}

 

/*Add Shortcode*/

/*for shortcode*/
function add_gallery()
{
/*code  */
}
add_shortcode( ‘my_gallery_shortcode’, ‘add_gallery’);

0 Comments

Leave a Comment