Skip to content

Commit

Permalink
Check if we're in the pure framework, and if so, add a submenu item t…
Browse files Browse the repository at this point in the history
…here instead of under Settings.
  • Loading branch information
jpederson committed May 21, 2019
1 parent 0b268b4 commit 45fd8d9
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions wordpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,6 @@
if ( function_exists( 'add_shortcode' ) ) {


/************************************
options keys for shortcode and
settings page
***********************************/
global $ta_options;
$ta_options = array(
'ta_consumer_key',
'ta_consumer_secret',
'ta_oauth_access_token',
'ta_oauth_access_token_secret',
'ta_usenames'
);



/************************************
shortcode [twitter-aggregator]
***********************************/
Expand Down Expand Up @@ -64,6 +49,16 @@ function twitter_aggregator_shortcode( $atts ) {
settings interface
***********************************/

// options in the array.
global $ta_options;
$ta_options = array(
'ta_consumer_key',
'ta_consumer_secret',
'ta_oauth_access_token',
'ta_oauth_access_token_secret',
'ta_usenames'
);

// register the settings for the first time.
function ta_register_settings() {
global $ta_options;
Expand All @@ -80,9 +75,19 @@ function ta_register_settings() {

// register the options page in the admin menu
function ta_register_options_page() {
add_options_page('Twitter Aggregator Settings', 'Twitter Aggregator', 'manage_options', 'ta', 'ta_options_page');

// if we're using the pure framework
if ( defined( 'PURE' ) ) {

// add as a submenu item
add_submenu_page( 'pure', 'Twitter Aggregator Settings', 'Twitter Aggregator', 'manage_options', 'theme_twitter_aggregator', 'ta_options_page' );
} else {

// otherwise, add as an item under 'Settings'
add_options_page( 'Twitter Aggregator Settings', 'Twitter Aggregator', 'manage_options', 'ta', 'ta_options_page' );
}
}
add_action('admin_menu', 'ta_register_options_page');
add_action( 'admin_menu', 'ta_register_options_page', 10 );


// the actual page output function
Expand Down

0 comments on commit 45fd8d9

Please sign in to comment.