Refactor create_functionHow to add an anonymous function in wordpress hooks by removing create_functionCustom post type single (permalink) throws a 404 errorCustom Registration username_exists / email_exists
What does it mean to "control target player"?
When two first person POV characters meet
Who are the remaining King/Queenslayers?
Unusual mail headers, evidence of an attempted attack. Have I been pwned?
Silly doubt about tidal effects and Einstein Field Equations
What exactly is the 'online' in OLAP and OLTP?
How to find the last non zero element in every column throughout dataframe?
How many children?
Dates on degrees don’t make sense – will people care?
Find the C-factor of a vote
What was the Shuttle Carrier Aircraft escape tunnel?
Does having had a visa for a country mean I used to be a citizen/national of that country?
Prime sieve in Python
Are all instances of trolls turning to stone ultimately references back to Tolkien?
Why is prior to creation called holy?
How to remove this component from PCB
Is a single radon-daughter atom in air a solid?
What size of powerbank will I need to power a phone and DSLR for 2 weeks?
What did River say when she woke from her proto-comatose state?
Non-flat partitions of a set
Suggested order for Amazon Prime Doctor Who series
What is the origin of Scooby-Doo's name?
Is this proposal by U.S. presidential candidate Pete Buttigieg to change the composition of the Supreme Court constitutional?
Is it damaging to turn off a small fridge for two days every week?
Refactor create_function
How to add an anonymous function in wordpress hooks by removing create_functionCustom post type single (permalink) throws a 404 errorCustom Registration username_exists / email_exists
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm getting several create_function is depreciated errors from a plugin as the result of a recent WP upgrade to 5.2. The plugin is no longer supported which means I need to refactor the code myself. Would anyone be able to get me pointed in the right direction?
function _options_page()
if($this->args['page_type'] == 'submenu')else
$this->page = add_theme_page(
$this->args['page_title'],
$this->args['menu_title'],
$this->args['page_cap'],
$this->args['page_slug'],
array(&$this, '_options_page_html'),
$this->args['menu_icon'],
$this->args['page_position']
);
if(true === $this->args['allow_sub_menu'])
//this is needed to remove the top level menu item from showing in the submenu
add_theme_page($this->args['page_slug'],$this->args['page_title'],'',$this->args['page_cap'],$this->args['page_slug'],create_function( '$a', "return null;" ));
foreach($this->sections as $k => $section)
add_theme_page(
$this->args['page_slug'],
$section['title'],
$section['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
create_function( '$a', "return null;" )
);
if(true === $this->args['show_import_export'])
add_theme_page(
$this->args['page_slug'],
__('Import / Export', 'nhp-opts'),
__('Import / Export', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=import_export_default',
create_function( '$a', "return null;" )
);
//if
foreach($this->extra_tabs as $k => $tab)
add_theme_page(
$this->args['page_slug'],
$tab['title'],
$tab['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
create_function( '$a', "return null;" )
);
if(true === $this->args['dev_mode'])
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
create_function( '$a', "return null;" )
);
//if
//if
//else
add_action('admin_print_styles-'.$this->page, array(&$this, '_enqueue'));
add_action('load-'.$this->page, array(&$this, '_load_page'));
//function
functions customization
add a comment |
I'm getting several create_function is depreciated errors from a plugin as the result of a recent WP upgrade to 5.2. The plugin is no longer supported which means I need to refactor the code myself. Would anyone be able to get me pointed in the right direction?
function _options_page()
if($this->args['page_type'] == 'submenu')else
$this->page = add_theme_page(
$this->args['page_title'],
$this->args['menu_title'],
$this->args['page_cap'],
$this->args['page_slug'],
array(&$this, '_options_page_html'),
$this->args['menu_icon'],
$this->args['page_position']
);
if(true === $this->args['allow_sub_menu'])
//this is needed to remove the top level menu item from showing in the submenu
add_theme_page($this->args['page_slug'],$this->args['page_title'],'',$this->args['page_cap'],$this->args['page_slug'],create_function( '$a', "return null;" ));
foreach($this->sections as $k => $section)
add_theme_page(
$this->args['page_slug'],
$section['title'],
$section['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
create_function( '$a', "return null;" )
);
if(true === $this->args['show_import_export'])
add_theme_page(
$this->args['page_slug'],
__('Import / Export', 'nhp-opts'),
__('Import / Export', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=import_export_default',
create_function( '$a', "return null;" )
);
//if
foreach($this->extra_tabs as $k => $tab)
add_theme_page(
$this->args['page_slug'],
$tab['title'],
$tab['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
create_function( '$a', "return null;" )
);
if(true === $this->args['dev_mode'])
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
create_function( '$a', "return null;" )
);
//if
//if
//else
add_action('admin_print_styles-'.$this->page, array(&$this, '_enqueue'));
add_action('load-'.$this->page, array(&$this, '_load_page'));
//function
functions customization
add a comment |
I'm getting several create_function is depreciated errors from a plugin as the result of a recent WP upgrade to 5.2. The plugin is no longer supported which means I need to refactor the code myself. Would anyone be able to get me pointed in the right direction?
function _options_page()
if($this->args['page_type'] == 'submenu')else
$this->page = add_theme_page(
$this->args['page_title'],
$this->args['menu_title'],
$this->args['page_cap'],
$this->args['page_slug'],
array(&$this, '_options_page_html'),
$this->args['menu_icon'],
$this->args['page_position']
);
if(true === $this->args['allow_sub_menu'])
//this is needed to remove the top level menu item from showing in the submenu
add_theme_page($this->args['page_slug'],$this->args['page_title'],'',$this->args['page_cap'],$this->args['page_slug'],create_function( '$a', "return null;" ));
foreach($this->sections as $k => $section)
add_theme_page(
$this->args['page_slug'],
$section['title'],
$section['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
create_function( '$a', "return null;" )
);
if(true === $this->args['show_import_export'])
add_theme_page(
$this->args['page_slug'],
__('Import / Export', 'nhp-opts'),
__('Import / Export', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=import_export_default',
create_function( '$a', "return null;" )
);
//if
foreach($this->extra_tabs as $k => $tab)
add_theme_page(
$this->args['page_slug'],
$tab['title'],
$tab['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
create_function( '$a', "return null;" )
);
if(true === $this->args['dev_mode'])
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
create_function( '$a', "return null;" )
);
//if
//if
//else
add_action('admin_print_styles-'.$this->page, array(&$this, '_enqueue'));
add_action('load-'.$this->page, array(&$this, '_load_page'));
//function
functions customization
I'm getting several create_function is depreciated errors from a plugin as the result of a recent WP upgrade to 5.2. The plugin is no longer supported which means I need to refactor the code myself. Would anyone be able to get me pointed in the right direction?
function _options_page()
if($this->args['page_type'] == 'submenu')else
$this->page = add_theme_page(
$this->args['page_title'],
$this->args['menu_title'],
$this->args['page_cap'],
$this->args['page_slug'],
array(&$this, '_options_page_html'),
$this->args['menu_icon'],
$this->args['page_position']
);
if(true === $this->args['allow_sub_menu'])
//this is needed to remove the top level menu item from showing in the submenu
add_theme_page($this->args['page_slug'],$this->args['page_title'],'',$this->args['page_cap'],$this->args['page_slug'],create_function( '$a', "return null;" ));
foreach($this->sections as $k => $section)
add_theme_page(
$this->args['page_slug'],
$section['title'],
$section['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
create_function( '$a', "return null;" )
);
if(true === $this->args['show_import_export'])
add_theme_page(
$this->args['page_slug'],
__('Import / Export', 'nhp-opts'),
__('Import / Export', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=import_export_default',
create_function( '$a', "return null;" )
);
//if
foreach($this->extra_tabs as $k => $tab)
add_theme_page(
$this->args['page_slug'],
$tab['title'],
$tab['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
create_function( '$a', "return null;" )
);
if(true === $this->args['dev_mode'])
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
create_function( '$a', "return null;" )
);
//if
//if
//else
add_action('admin_print_styles-'.$this->page, array(&$this, '_enqueue'));
add_action('load-'.$this->page, array(&$this, '_load_page'));
//function
functions customization
functions customization
asked Jun 13 at 0:40
Jobbie DaddyJobbie Daddy
276
276
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
There is an inbuilt function for returning null: __return_null.
So you can replace create_function('$a', 'return null;'); with just '__return_null' (note the quotes) as it seems $a is not used anyway.
Or you can use an anonymous function as the argument directly: function($a) return null; (no quotes). Either way since the argument is expecting a function calback.
add a comment |
You should be able to change create_function( '$a', "return null;" ) to Anonymous Function (aka Closure) :
From :
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
create_function( '$a', "return null;" )
);
To :
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
function($a) return null;
);
full code changes :
function _options_page()
if($this->args['page_type'] == 'submenu')else
$this->page = add_theme_page(
$this->args['page_title'],
$this->args['menu_title'],
$this->args['page_cap'],
$this->args['page_slug'],
array(&$this, '_options_page_html'),
$this->args['menu_icon'],
$this->args['page_position']
);
if(true === $this->args['allow_sub_menu'])
//this is needed to remove the top level menu item from showing in the submenu
add_theme_page(
$this->args['page_slug'],
$this->args['page_title'],
'',
$this->args['page_cap'],
$this->args['page_slug'],
function($a) return null;
);
foreach($this->sections as $k => $section)
add_theme_page(
$this->args['page_slug'],
$section['title'],
$section['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
function($a) return null;
);
if(true === $this->args['show_import_export'])
add_theme_page(
$this->args['page_slug'],
__('Import / Export', 'nhp-opts'),
__('Import / Export', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=import_export_default',
function($a) return null;
);
//if
foreach($this->extra_tabs as $k => $tab)
add_theme_page(
$this->args['page_slug'],
$tab['title'],
$tab['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
function($a) return null;
);
if(true === $this->args['dev_mode'])
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
function($a) return null;
);
//if
//if
//else
add_action('admin_print_styles-'.$this->page, array(&$this, '_enqueue'));
add_action('load-'.$this->page, array(&$this, '_load_page'));
//function
New contributor
Adnane Zarrouk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "110"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f340362%2frefactor-create-function%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is an inbuilt function for returning null: __return_null.
So you can replace create_function('$a', 'return null;'); with just '__return_null' (note the quotes) as it seems $a is not used anyway.
Or you can use an anonymous function as the argument directly: function($a) return null; (no quotes). Either way since the argument is expecting a function calback.
add a comment |
There is an inbuilt function for returning null: __return_null.
So you can replace create_function('$a', 'return null;'); with just '__return_null' (note the quotes) as it seems $a is not used anyway.
Or you can use an anonymous function as the argument directly: function($a) return null; (no quotes). Either way since the argument is expecting a function calback.
add a comment |
There is an inbuilt function for returning null: __return_null.
So you can replace create_function('$a', 'return null;'); with just '__return_null' (note the quotes) as it seems $a is not used anyway.
Or you can use an anonymous function as the argument directly: function($a) return null; (no quotes). Either way since the argument is expecting a function calback.
There is an inbuilt function for returning null: __return_null.
So you can replace create_function('$a', 'return null;'); with just '__return_null' (note the quotes) as it seems $a is not used anyway.
Or you can use an anonymous function as the argument directly: function($a) return null; (no quotes). Either way since the argument is expecting a function calback.
edited Jun 13 at 2:09
answered Jun 13 at 1:07
majickmajick
3,8831724
3,8831724
add a comment |
add a comment |
You should be able to change create_function( '$a', "return null;" ) to Anonymous Function (aka Closure) :
From :
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
create_function( '$a', "return null;" )
);
To :
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
function($a) return null;
);
full code changes :
function _options_page()
if($this->args['page_type'] == 'submenu')else
$this->page = add_theme_page(
$this->args['page_title'],
$this->args['menu_title'],
$this->args['page_cap'],
$this->args['page_slug'],
array(&$this, '_options_page_html'),
$this->args['menu_icon'],
$this->args['page_position']
);
if(true === $this->args['allow_sub_menu'])
//this is needed to remove the top level menu item from showing in the submenu
add_theme_page(
$this->args['page_slug'],
$this->args['page_title'],
'',
$this->args['page_cap'],
$this->args['page_slug'],
function($a) return null;
);
foreach($this->sections as $k => $section)
add_theme_page(
$this->args['page_slug'],
$section['title'],
$section['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
function($a) return null;
);
if(true === $this->args['show_import_export'])
add_theme_page(
$this->args['page_slug'],
__('Import / Export', 'nhp-opts'),
__('Import / Export', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=import_export_default',
function($a) return null;
);
//if
foreach($this->extra_tabs as $k => $tab)
add_theme_page(
$this->args['page_slug'],
$tab['title'],
$tab['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
function($a) return null;
);
if(true === $this->args['dev_mode'])
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
function($a) return null;
);
//if
//if
//else
add_action('admin_print_styles-'.$this->page, array(&$this, '_enqueue'));
add_action('load-'.$this->page, array(&$this, '_load_page'));
//function
New contributor
Adnane Zarrouk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
You should be able to change create_function( '$a', "return null;" ) to Anonymous Function (aka Closure) :
From :
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
create_function( '$a', "return null;" )
);
To :
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
function($a) return null;
);
full code changes :
function _options_page()
if($this->args['page_type'] == 'submenu')else
$this->page = add_theme_page(
$this->args['page_title'],
$this->args['menu_title'],
$this->args['page_cap'],
$this->args['page_slug'],
array(&$this, '_options_page_html'),
$this->args['menu_icon'],
$this->args['page_position']
);
if(true === $this->args['allow_sub_menu'])
//this is needed to remove the top level menu item from showing in the submenu
add_theme_page(
$this->args['page_slug'],
$this->args['page_title'],
'',
$this->args['page_cap'],
$this->args['page_slug'],
function($a) return null;
);
foreach($this->sections as $k => $section)
add_theme_page(
$this->args['page_slug'],
$section['title'],
$section['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
function($a) return null;
);
if(true === $this->args['show_import_export'])
add_theme_page(
$this->args['page_slug'],
__('Import / Export', 'nhp-opts'),
__('Import / Export', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=import_export_default',
function($a) return null;
);
//if
foreach($this->extra_tabs as $k => $tab)
add_theme_page(
$this->args['page_slug'],
$tab['title'],
$tab['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
function($a) return null;
);
if(true === $this->args['dev_mode'])
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
function($a) return null;
);
//if
//if
//else
add_action('admin_print_styles-'.$this->page, array(&$this, '_enqueue'));
add_action('load-'.$this->page, array(&$this, '_load_page'));
//function
New contributor
Adnane Zarrouk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
You should be able to change create_function( '$a', "return null;" ) to Anonymous Function (aka Closure) :
From :
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
create_function( '$a', "return null;" )
);
To :
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
function($a) return null;
);
full code changes :
function _options_page()
if($this->args['page_type'] == 'submenu')else
$this->page = add_theme_page(
$this->args['page_title'],
$this->args['menu_title'],
$this->args['page_cap'],
$this->args['page_slug'],
array(&$this, '_options_page_html'),
$this->args['menu_icon'],
$this->args['page_position']
);
if(true === $this->args['allow_sub_menu'])
//this is needed to remove the top level menu item from showing in the submenu
add_theme_page(
$this->args['page_slug'],
$this->args['page_title'],
'',
$this->args['page_cap'],
$this->args['page_slug'],
function($a) return null;
);
foreach($this->sections as $k => $section)
add_theme_page(
$this->args['page_slug'],
$section['title'],
$section['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
function($a) return null;
);
if(true === $this->args['show_import_export'])
add_theme_page(
$this->args['page_slug'],
__('Import / Export', 'nhp-opts'),
__('Import / Export', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=import_export_default',
function($a) return null;
);
//if
foreach($this->extra_tabs as $k => $tab)
add_theme_page(
$this->args['page_slug'],
$tab['title'],
$tab['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
function($a) return null;
);
if(true === $this->args['dev_mode'])
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
function($a) return null;
);
//if
//if
//else
add_action('admin_print_styles-'.$this->page, array(&$this, '_enqueue'));
add_action('load-'.$this->page, array(&$this, '_load_page'));
//function
New contributor
Adnane Zarrouk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
You should be able to change create_function( '$a', "return null;" ) to Anonymous Function (aka Closure) :
From :
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
create_function( '$a', "return null;" )
);
To :
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
function($a) return null;
);
full code changes :
function _options_page()
if($this->args['page_type'] == 'submenu')else
$this->page = add_theme_page(
$this->args['page_title'],
$this->args['menu_title'],
$this->args['page_cap'],
$this->args['page_slug'],
array(&$this, '_options_page_html'),
$this->args['menu_icon'],
$this->args['page_position']
);
if(true === $this->args['allow_sub_menu'])
//this is needed to remove the top level menu item from showing in the submenu
add_theme_page(
$this->args['page_slug'],
$this->args['page_title'],
'',
$this->args['page_cap'],
$this->args['page_slug'],
function($a) return null;
);
foreach($this->sections as $k => $section)
add_theme_page(
$this->args['page_slug'],
$section['title'],
$section['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
function($a) return null;
);
if(true === $this->args['show_import_export'])
add_theme_page(
$this->args['page_slug'],
__('Import / Export', 'nhp-opts'),
__('Import / Export', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=import_export_default',
function($a) return null;
);
//if
foreach($this->extra_tabs as $k => $tab)
add_theme_page(
$this->args['page_slug'],
$tab['title'],
$tab['title'],
$this->args['page_cap'],
$this->args['page_slug'].'&tab='.$k,
function($a) return null;
);
if(true === $this->args['dev_mode'])
add_theme_page(
$this->args['page_slug'],
__('Dev Mode Info', 'nhp-opts'),
__('Dev Mode Info', 'nhp-opts'),
$this->args['page_cap'],
$this->args['page_slug'].'&tab=dev_mode_default',
function($a) return null;
);
//if
//if
//else
add_action('admin_print_styles-'.$this->page, array(&$this, '_enqueue'));
add_action('load-'.$this->page, array(&$this, '_load_page'));
//function
New contributor
Adnane Zarrouk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited Jun 13 at 1:13
New contributor
Adnane Zarrouk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered Jun 13 at 1:08
Adnane ZarroukAdnane Zarrouk
295
295
New contributor
Adnane Zarrouk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Adnane Zarrouk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
Thanks for contributing an answer to WordPress Development Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f340362%2frefactor-create-function%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown