Don’t use a function for the callback, use a class. Something like this:
class Competition_Manager_Page
{
private $extra;
public function set_extra( $value )
{
$this->extra = $value;
}
public function render()
{
// show you page content, then:
print $this->extra;
}
}
You can extend the class’ functionality later.
Now, when you register the menu, create an instance of that class first, and add you extra data:
$page = new Competition_Manager_Page;
$page->set_extra( 'Test' );
add_menu_page(
'Competition Manager 2013-2014',
'2013-2014',
'manage_options',
'manager_2013_2014',
array( $page, 'render' ), // replacement for the former function
plugins_url( 'competition-manager/images/cup.png' ), 81
);
Related Posts:
- Redirect to another page using contact form 7? [closed]
- Create survey that redirects to sidebar menu customized to answers
- How to structure a plugin
- is_plugin_active function doesn’t exist
- Custom pages with plugin
- WordPress Plugin Development In MVC Architecture, How?
- Checking if an attribute exists in a shortcode
- Add section (add_settings_section) to a custom page (add_submenu_page)
- Show Similar Post Titles ( Similar to Stack Exchange )
- How do I unlock a post programmatically?
- Create page when plugin is activated
- How to call “page specific menu items” in template [closed]
- How can I limit functionality in one version of a plugin?
- WordPress Plugin as ‘Library’ From Abstract Application?
- How to show custom message once on plugin activation?
- Plugin development: how to create a form and get custom data?
- How to list the Hooks and order of execution in current loading page? [duplicate]
- How to load a new template page according to a particular URL?
- Master menu item for multiple plugins?
- WordPress network: set themes and plugins for new blog
- Updating post meta for custom post types
- Failed to invoke other hook from the init hook
- wp_verify_nonce() why return false?
- Detecting when a custom taxonomy has been changed and display alert?
- Can a plugin add to header/footer/body content?
- Created Widget Not Showing up on Admin Panel
- REST-API: extend media-endpoint
- Hide Theme options and Customize Admin menu
- How use %like% in sql statement wordpress
- Is there a way to alter the order in which the plugins appear in the page?
- Custom plugins/Manipulated plugins: Always a terrible idea to inherit these types of WP sites that discourage updates? [closed]
- How to use get_theme_mod in gutenberg editor wordpress?
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- How to make a customize role and view a specific plugins base on that role?
- WordPress plugin – Error “Plugin generate 2890 characters of unexpected output when activated”
- My plugin wants to update another plugin
- JS Support Ticket – Auto create WP account
- Edit Yoast SEO breadcrumbs output [closed]
- How would I go about creating a user ranked post popularity page?
- Disable woocommerce cookies and delete cart data automatically
- How to fetch products with the price in a page on woocommerce using a form or live search with php
- custom payment gateway in woocommerce failed to connect to remote api server
- Best way to maintain and update 3rd-party WP plugin when developer is unresponsive?
- Customization API for plugin development
- Fromcraft Plugin On click submit button [closed]
- Suggestions on Approach to New Plugin I’m Stuck On
- Dynamic admin submenu
- How to redirect users to their profile after they successfully edit their profile
- Custom post types – remove default post supports through empty array?
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- Plugin function inside custom plugin
- creating a plug in that would tap into save/update action of posts [closed]
- Why WP_Screeen doesn’t show all options with admin_body_class
- Loop in elementor custom widget not working
- Minimize and Uglify WordPress Plugin Files
- How to create a plugin that includes all the other plugins?
- Why is it important to check for isset and is_array before checking in_array in this example?
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- Delete data from custom table when deleting a post
- Integrating Custom Database with WordPress
- How do i specify a url to which to redirect the user after he logs out from facebook?
- I cannot include a file in my plugin settings page
- unregister a sidebar widget
- How to keep plugin (media-sync) running even the tab is closed?
- Check if theme supports sidebar
- Display posts by alphabetical order
- How to access a wordpress plugin page or add posts without doing it from the WordPress dashboard?
- WP Forms not displaying,becomming an fatal error
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Ultimate Members Default Post Layout problem
- Rename a folder via HTML POST request
- Move plugin pages from dashboard to front-end
- working code, not working – Plugin Dev
- Cannot view Custom Post Type no matter what I try
- Custom wp_list_tables redirect on specfic page
- Paid Membership Pro displaying a user name in PHP
- Installation failed, trying to install ANY plugin
- Echo custom admin field into a is_single()
- How to use custom footer template in a site-plugin?
- Creating Nested custom fields
- Confusing problem with displaying message recipient metadata
- Why the output of an image gallery plugin is not displayed into a page of my custom theme?
- Update Plugin Without Overwriting Custom Settings
- Display_rows() and column_cb() strange behaviour
- show Visual form builder in the front end
- Redirect url in plugin to somewhere else?
- Get page type to display content
- How wordpress plugin hooks works? [duplicate]
- How to generate a responsive output from plugin?
- How can I create a navigation menu in the sidebar that can also act like a slider?
- How to add image for custom taxonomy
- What can I do to customize a widget provided with this plugin? from where have I to start?
- WordPress Customise
- Why haven’t I see plugins using get_file_data to handle retrieving plugin version?
- Plugin: Custom menu item problem
- How can I properly sanitize the update_option in WordPress?
- Take Elementor For Email FIeld Check if user is registered. IF not registered then register on woocommerece
- WordPress isn’t sending welcome email with the password reset
- How to make a Template page to show the information of different things Shop and Product page?
- Submitting form to admin-post.php WordPress