272 posts WordPress Theme Devoloper
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+6 more
kayapati says

Hi mates

How to activate my theme options settings page immediately after theme is activated?

I have seen few themes are working like this.

Can any one explain how to do it?

1950 posts Do the Needful
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
+10 more
JamiGibbs says
Hi mates

How to activate my theme options settings page immediately after theme is activated?

I have seen few themes are working like this.

Can any one explain how to do it?

Do you mean that you purchased a theme and don’t see the options settings? If so:

Have you activated the theme from the “Appearance > Themes” menu?

Then your theme options settings should automatically appear in the WP admin menu on the left of your screen. Sometimes the theme options will have its own standalone link, other times it will be under the “Appearance” dropdown.

If you mean you’re developing a theme and trying to create a theme options panel for it then I suggest reading this tutorial:

http://net.tutsplus.com/tutorials/wordpress/how-to-create-a-better-wordpress-options-panel/

Specifically the line of code where it adds the theme options to your WP admin menu is:

add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'mytheme_admin');  
# }  

You can read about adding administration menus in Wordpress here:

http://codex.wordpress.org/Adding_Administration_Menus

164 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
tonyc says

I think he wants to redirect users to the theme options page when they activate his theme.

You can use the “after_setup_theme” hook introduced in WordPress 3.0 to execute some javascript to redirect the user to the theme settings page.

More info on the hook here:

http://adambrown.info/p/wp_hooks/hook/after_setup_theme?version=3.0&file=wp-settings.php

122 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
+2 more
jayjdk says

@tonyc,

The “switch_theme” hook would be better as it only runs when the user switch theme. “after_setup_theme” runs on every page (http://codex.wordpress.org/Plugin_API/Action_Reference )

164 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
tonyc says

Yep, you are 100% correct on that

272 posts WordPress Theme Devoloper
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+6 more
kayapati says

Thank you friends

122 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
+2 more
jayjdk says

If it doesn’t work, try this

global $pagenow;

if ( is_admin() && 'themes.php' == $pagenow && isset( $_GET['activated'] ) ) {

}

http://foolswisdom.com/wp-activate-theme-actio/

195 posts Aivah
  • Has referred 1000+ members
  • Has sold $500,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been a beta tester for an Envato feature
+9 more
AivahThemes says

Kayapati use the below code

<?php if ($_GET['activated']){ wp_redirect(admin_url("admin.php?page=theme_options.php")); } ?>
272 posts WordPress Theme Devoloper
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+6 more
kayapati says
Kayapati use the below code <?php if ($_GET['activated']){ wp_redirect(admin_url("admin.php?page=theme_options.php")); } ?>

Faheem

I get the bellow error when I use the above code in function.php

can you tell me where I need to place the above code?

The error I get:

“You do not have sufficient permissions to access this page.”

195 posts Aivah
  • Has referred 1000+ members
  • Has sold $500,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been a beta tester for an Envato feature
+9 more
AivahThemes says

I will drop you an email with the code direction on how to make this activated.

by
by
by
by
by
by