Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // wordpress plugin requirements
- // add option/menu page in plugin
- // source link : https://codex.wordpress.org/Administration_Menus
- // source link : https://codex.wordpress.org/Function_Reference/add_menu_page
- // step 1
- if(! function_exists('news_ticker_option_page')):
- function news_ticker_option_page(){
- // add_menu_page or add_options_page
- add_menu_page(
- 'News ticker options', // page_title
- 'News Ticker Plugin', // menu_title
- 'manage_options', //capability will go step 3
- 'ticker.php', // menu_slug this show in url
- 'news_ticker_plugin_page', // function wiil go step 3
- /* The below option only for add_menu_page */
- //plugins_url('/news-ticker/images/icon.png'),25 // only for add_menu_page and icon (20X20 size) insert 25 this will indicate position
- 'dashicons-welcome-write-blog',25 // 25 this will indicate position +++ wordpress font icon usage source link: https://developer.wordpress.org/resource/dashicons/
- );
- }
- add_action('admin_menu','news_ticker_option_page');
- endif;
- // step 2 for API Settings
- if(! function_exists('news_ticker_plugin_page')):
- function news_ticker_plugin_page() {
- if ( !current_user_can( 'manage_options' ) ) {
- wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
- }
- echo '<div class="wrap"><h2>This is news ticker options</h2><div>'; // this will show the mail title on the top of page
- ?>
- <div class="wrap">
- <h1>Owl Carousel Settings</h1>
- <table class="form-table">
- <tbody>
- <tr>
- <th scope="row">
- <label for="blogname">Site Title</label>
- </th>
- <td>
- <input id="blogname" class="regular-text" type="text" placeholder="<?php echo get_option('blogname');?>" name="blogname">
- </td>
- </tr>
- </tbody>
- </table>
- <input name="submit" id="submit" class="button button-primary" value="Save Changes" type="submit">
- </div>
- <?php
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement