Skip to content

Commit

Permalink
add option to not load default css, closes #54
Browse files Browse the repository at this point in the history
  • Loading branch information
aschweigert committed Jul 26, 2017
1 parent eb45126 commit 9e25f27
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions includes/class-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ public function register_options() {
);

// Add a section for network option.
add_settings_section(
'css_options',
'Default CSS',
array( $this, 'css_section_intro' ),
'doubleclick-for-wordpress'
);

// Add a section for documentation link.
add_settings_section(
'documentation_options',
'Documentation',
Expand All @@ -177,8 +185,18 @@ public function register_options() {
'breakpoint_options'
);

// Default CSS
add_settings_field(
'dfw_css',
'Use default CSS?',
array( $this, 'css_input' ),
'doubleclick-for-wordpress',
'css_options'
);

register_setting( 'doubleclick-for-wordpress', 'dfw_network_code', array( $this, 'network_code_save' ) );
register_setting( 'doubleclick-for-wordpress', 'dfw_breakpoints', array( $this, 'breakpoints_save' ) );
register_setting( 'doubleclick-for-wordpress', 'dfw_css' );

}

Expand All @@ -191,6 +209,10 @@ public function breakpoints_section_intro() {
echo '<em>Example: phone: 0 to 480, tablet 480 to 768, desktop 768 to 9999.</em>';
}

public function css_section_intro() {
echo "This plugin has some default CSS to properly label ad units as advertisements and make sure they work with most themes. Check if you would you like to use this default CSS.";
}

public function documentation_section_intro() {
echo '<a href="https://github.com/INN/DoubleClick-for-WordPress/blob/master/docs/index.md">Available on GitHub</a>';
}
Expand Down Expand Up @@ -253,6 +275,11 @@ class="small-text" />

}

public function css_input() {
$checked = ! empty( get_option( 'dfw_css' ) );
echo '<input type="checkbox" value="true" name="dfw_css"' . checked( $checked, 1, false ) . '>';
}

public function network_code_save( $value ) {
$message = null;
$type = null;
Expand Down Expand Up @@ -313,4 +340,5 @@ public function breakpoints_save( $value ) {

return $dfw_breakpoints;
}

}

0 comments on commit 9e25f27

Please sign in to comment.