- Author had a Free File of the Month
- Author was Featured
- Bought between 1 and 9 items
- Exclusive Author
- Has been a member for 4-5 years
- Most Wanted Bounty Winner
- Referred between 1 and 9 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
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?
- Envato Staff
- Sold between 100 000 and 250 000 dollars
- Support Staff
- United States
- Author had a Free File of the Month
- Microlancer Beta Tester
- Beta Tester
- Interviewed on the Envato Notes blog
Hi matesHow 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:
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
@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 )
Yep, you are 100% correct on that
- Author had a Free File of the Month
- Author was Featured
- Bought between 1 and 9 items
- Exclusive Author
- Has been a member for 4-5 years
- Most Wanted Bounty Winner
- Referred between 1 and 9 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
Thank you friends
If it doesn’t work, try this
global $pagenow;
if ( is_admin() && 'themes.php' == $pagenow && isset( $_GET['activated'] ) ) {
}
- Microlancer Beta Tester
- Exclusive Author
- Sold between 250 000 and 1 000 000 dollars
- Item was Featured
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 10 and 49 items
- Referred between 1000 and 1999 users
Kayapati use the below code
<?php if ($_GET['activated']){
wp_redirect(admin_url("admin.php?page=theme_options.php"));
}
?>
- Author had a Free File of the Month
- Author was Featured
- Bought between 1 and 9 items
- Exclusive Author
- Has been a member for 4-5 years
- Most Wanted Bounty Winner
- Referred between 1 and 9 users
- Repeatedly Helped protect Envato Marketplaces against copyright violations
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.”
- Microlancer Beta Tester
- Exclusive Author
- Sold between 250 000 and 1 000 000 dollars
- Item was Featured
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 10 and 49 items
- Referred between 1000 and 1999 users
I will drop you an email with the code direction on how to make this activated.
