3007 posts
  • Author had a File in an Envato Bundle
  • Bought between 1 and 9 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 100 and 199 users
+2 more
duotive says

could you post the code here please for other guys like me?:D

2441 posts
  • Has been a member for 5-6 years
  • Exclusive Author
  • Europe
  • Bought between 10 and 49 items
  • Referred between 100 and 199 users
  • Sold between 100 and 1 000 dollars
  • Envato Studio (Microlancer) Beta Tester
digitalimpact says
could you post the code here please for other guys like me?:D

+1, please share :)

4317 posts ThemeForest Reviewer
  • Envato Staff
  • Reviewer
  • Community Moderator
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Venezuela
  • Has been a member for 5-6 years
  • Envato Studio (Microlancer) Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
+9 more
Ivor Reviewer says
could you post the code here please for other guys like me?:D

+1 :P

1579 posts Chris Robinson
  • United States
  • Sold between 250 000 and 1 000 000 dollars
  • Elite Author
  • Has been a member for 5-6 years
  • Author had a File in an Envato Bundle
  • Referred between 500 and 999 users
  • Author had a Free File of the Month
+5 more
contempoinc says

This is what I use:


if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
    //Call action that sets
    add_action('admin_head','ct_option_setup');
    //Do redirect
    header( 'Location: '.admin_url().'admin.php?page=options_panel.php' ) ;
}

688 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 1 and 9 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 5 000 and 10 000 dollars
  • Uruguay
_rg_ says

I guess that code wil work on a custom admin page, but if you have a simple Theme Optioins page, the path url and php page is different.

In that case i use this in my functions.php:

function my_options_add_page() {
    add_theme_page( __( 'Theme Options' ), __( 'Theme Options' ), 'administrator', 'your-theme-options-page-slug', 'my_options_do_options');
}

function my_options_do_options(){

 // do the options page here....

}

add_action( 'admin_menu', 'my_options_add_page' );

if ($_GET['activated']){
    wp_redirect(admin_url("themes.php?page=your-theme-options-page-slug"));
}

So, once theme is actived, it redirects to the Appereance > Theme Options page, which acctualy is the my_options_do_options function. I don´t need to tell the IF if i´m on themes page, since the $_GET[‘activated’] is only used there. Also, i don´t need to tell that IF ´m administrator, since the add_theme_page is restricted for “administrator” level as you can see on code.

2322 posts
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Europe
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 100 and 199 users
+1 more
CreativeMilk says
This is what I use:

if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
    //Call action that sets
    add_action('admin_head','ct_option_setup');
    //Do redirect
    header( 'Location: '.admin_url().'admin.php?page=options_panel.php' ) ;
}

Where do you place this code? in the wp-includes/function.php file?

244 posts WordPress Theme Devoloper
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 5-6 years
  • Most Wanted Bounty Winner
  • Referred between 1 and 9 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+1 more
kayapati says
I guess that code wil work on a custom admin page, but if you have a simple Theme Optioins page, the path url and php page is different.

In that case i use this in my functions.php:

function my_options_add_page() {
    add_theme_page( __( 'Theme Options' ), __( 'Theme Options' ), 'administrator', 'your-theme-options-page-slug', 'my_options_do_options');
}

function my_options_do_options(){

 // do the options page here....

}

add_action( 'admin_menu', 'my_options_add_page' );

if ($_GET['activated']){
    wp_redirect(admin_url("themes.php?page=your-theme-options-page-slug"));
}

The above code worked me perfectly. Thanks rg :)

244 posts WordPress Theme Devoloper
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 5-6 years
  • Most Wanted Bounty Winner
  • Referred between 1 and 9 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+1 more
kayapati says
This is what I use:

if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
    //Call action that sets
    add_action('admin_head','ct_option_setup');
    //Do redirect
    header( 'Location: '.admin_url().'admin.php?page=options_panel.php' ) ;
}

Where do you place this code? in the wp-includes/function.php file?

yes you need to add it in function.php

4317 posts ThemeForest Reviewer
  • Envato Staff
  • Reviewer
  • Community Moderator
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Venezuela
  • Has been a member for 5-6 years
  • Envato Studio (Microlancer) Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
+9 more
Ivor Reviewer says

Thanks guys that will be very helpful for my next theme.

688 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • Referred between 1 and 9 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 5 000 and 10 000 dollars
  • Uruguay
_rg_ says
This is what I use:

if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
    //Call action that sets
    add_action('admin_head','ct_option_setup');
    //Do redirect
    header( 'Location: '.admin_url().'admin.php?page=options_panel.php' ) ;
}

Where do you place this code? in the wp-includes/function.php file?

You don´t need to touch the wp includes, just in your theme/functions.php file.

by
by
by
by
by
by