Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using wordpress 3.3. I've created a plugin

My plugin details:

My plugin creates a sub menu under Network settings and create two form fields to define adsense code (200 x 200 ad, 300 x 250 ad).

Here is the screenshot. enter image description here This is my plugin code for network super admin.

http://pastebin.com/88gLTK2a

I'm using this code to print the code in my theme (sidebar).

<?php ads1(); ?>

and

<?php ads2(); ?>

But its not working..

When i use the plugin for normal admins its working perfectly. This is the plugin code for normal admins

http://pastebin.com/8KxPDJKA

This is the difference between both versions http://pastebin.com/diff.php?i=8KxPDJKA

I have no idea why the normal admin version working and super admin version not working.

I tried to print the function plugin itself, its working in network admin.

But its not working when i call it outside the network admin.

Can anyone tell me whats wrong in my code? Is there any special hook available to retrieve the value outside the network.

Update:

functions ads1(); and ads2(); working. But they are working only within the plugin. I . They actually working. But when i use the same functions in my wordpress theme(sidebar.php) it doesn't output anything.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Have you seen these?

get_blog_option()
update_blog_option()
delete_blog_option()

I'm on a mobile now so I can't re-check this, but my guess is that the option value gets stored in your 'master' blog table and you're trying to access it from a different blog/site. Could that be the case?

Try passing the master blog ID to the functions listed above. Something like:

$options = get_blog_option( 1, 'ad_options' );

Just a guess though .)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.