Created
June 9, 2014 15:27
-
-
Save kellenmace/76db51fc2742cac1bcf3 to your computer and use it in GitHub Desktop.
OOP Settings Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Admin page markup | |
* @since 0.1.0 | |
*/ | |
public function admin_page_display() { | |
self::admin_page_setup(); | |
?> | |
<div class="wrap cmb_options_page <?php echo self::$key; ?>"> | |
<h2><?php echo esc_html( get_admin_page_title() ) . ' Settings'; ?></h2> | |
<form method="post" action="options.php"> | |
<?php settings_fields( self::$key ); ?> | |
<?php do_settings_sections( self::$key ); ?> | |
<?php submit_button(); ?> | |
</form> | |
</div> | |
<?php | |
} | |
/** | |
* Defines the plugin option page sections and fields | |
* @since 0.1.0 | |
* @return array | |
*/ | |
public static function admin_page_setup() { | |
add_settings_section( | |
'fb_pxl_display_on', | |
'Display Facebook Conversion Pixel fields on:', | |
'', | |
self::$key | |
); | |
add_settings_field( | |
'fb_pxl_display_on_posts', | |
'Posts', | |
array( $this, 'fb_pxl_display_on_posts_output' ), | |
self::$key, | |
'fb_pxl_display_on' | |
); | |
} | |
public static function fb_pxl_display_on_posts_output() { | |
$value = isset( self::$fb_pxl_options[ 'posts' ] ) ? | |
$options[ 'test_value' ] : ''; | |
$html = '<input type="checkbox" id="fb_pxl_disable_posts" name="self::$fb_pxl_options[posts]" value="on"' . checked($value, "on", false) . '/>'; | |
echo $html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment