Community Page
- www.wp-fun.co.uk Jump to website »
-
Subscribe -
Community
-
Top Commenters
-
Popular Threads
-
Recent Comments
- Hi there Andrew. your "Fun with Categories" plugin is certainly a very useful plugin. But I am having a little bit of trouble and was wondering if there is any example templates out...
- Great post! I've bookmarked your blog. Hope we can swap links. Why can't I open your rss feed? No post is showing. Best Regards! Ginj
- Can you paste the entire error in?
- I'm getting the Parse error: syntax error, unexpected T_STRING, expecting '(' in error too.
- Atompub is really available or not? But i think this project will be more useful for the normal people to understand..Always Google rocks and leave their marks in every field..
4 months ago
But I'm trying to figure out how to pass an argument to the callback function. Actually, I don't know if it could be done :(
Eg.
$as = array('A', 'B', 'C', 'D');
$adb = null;
function my_new_settings(){
global $as;
foreach($as as $a):
$adb = sanitize_title($a);
register_setting('media',"{$adb}_1");
register_setting('media',"{$adb}_2");
add_settings_field("{$adb}" , "{$a} setting:" ,
'my_new_callback' , 'media' , 'default');
endforeach;
}
function my_new_callback(){
global $adb;
echo "<label for=\"{$adb}_1\">Setting 1</label>
<input name=\"{$adb}_1\" id=\"{$adb}_1\" value=\"".attribute_escape(get_option("{$adb}_1"))."\" class=\"small-text\" type=\"text\">
<label for=\"{$adb}_2\">Setting 2</label>
<input name=\"{$adb}_2\" id=\"{$adb}_2\" value=\"".attribute_escape(get_option("{$adb}_2"))."\" class=\"small-text\" type=\"text\">
";
}
add_action('admin_init', 'my_new_settings');
Maybe I'm missing something? Thanks in advance!
4 months ago
class myPlugin
{
private $myVar = 10;
function myCallBack(){
$newVar = $this->myVar;
}
}
4 months ago
I've tried to do this but $this->adb value is always returning 'd' (the last item of my $as array).
I think I'll need to do it the old way (a new admin page) :(
Again, thanks for your time!