WP Add Custom CSS - Version 0.9.5

Version Description

  • Improved css output for single posts and pages
Download this release

Release Info

Developer danieledesantis
Plugin Icon 128x128 WP Add Custom CSS
Version 0.9.5
Comparing to
See all releases

Code changes from version 0.9.4 to 0.9.5

languages/en.mo CHANGED
Binary file
languages/en.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Wordpress Add Custom CSS\n"
4
- "POT-Creation-Date: 2014-10-04 16:46+0100\n"
5
- "PO-Revision-Date: 2014-10-04 16:46+0100\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: en\n"
@@ -16,34 +16,55 @@ msgstr ""
16
  "X-Poedit-KeywordsList: __;_e\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
 
19
  #: ../wordpress-add-custom-css.php:62
20
  msgid "Custom CSS"
21
  msgstr ""
22
 
23
- #: ../wordpress-add-custom-css.php:88
24
- msgid "Add custom CSS rules for this "
 
 
25
  msgstr ""
26
 
27
- #: ../wordpress-add-custom-css.php:101
 
28
  msgid "Wordpress Add Custom CSS"
29
  msgstr ""
30
 
31
- #: ../wordpress-add-custom-css.php:105
 
32
  msgid "Save"
33
  msgstr ""
34
 
35
- #: ../wordpress-add-custom-css.php:107
 
36
  msgid "Credits"
37
  msgstr ""
38
 
39
- #: ../wordpress-add-custom-css.php:109
 
40
  msgid "\"WP Add Custom CSS\" is a plugin by"
41
  msgstr ""
42
 
43
- #: ../wordpress-add-custom-css.php:116
 
44
  msgid "Write here the CSS rules you want to apply to the whole website."
45
  msgstr ""
46
 
 
47
  #: ../wordpress-add-custom-css.php:202
48
  msgid "Settings"
49
  msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Wordpress Add Custom CSS\n"
4
+ "POT-Creation-Date: 2015-05-10 19:07+0100\n"
5
+ "PO-Revision-Date: 2015-05-10 19:07+0100\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: en\n"
16
  "X-Poedit-KeywordsList: __;_e\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:62
20
  #: ../wordpress-add-custom-css.php:62
21
  msgid "Custom CSS"
22
  msgstr ""
23
 
24
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:89
25
+ #: ../wordpress-add-custom-css.php:89
26
+ #, php-format
27
+ msgid "Add custom CSS rules for this %s"
28
  msgstr ""
29
 
30
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:102
31
+ #: ../wordpress-add-custom-css.php:95 ../wordpress-add-custom-css.php:102
32
  msgid "Wordpress Add Custom CSS"
33
  msgstr ""
34
 
35
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:106
36
+ #: ../wordpress-add-custom-css.php:106
37
  msgid "Save"
38
  msgstr ""
39
 
40
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:108
41
+ #: ../wordpress-add-custom-css.php:108
42
  msgid "Credits"
43
  msgstr ""
44
 
45
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:110
46
+ #: ../wordpress-add-custom-css.php:110
47
  msgid "\"WP Add Custom CSS\" is a plugin by"
48
  msgstr ""
49
 
50
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:117
51
+ #: ../wordpress-add-custom-css.php:117
52
  msgid "Write here the CSS rules you want to apply to the whole website."
53
  msgstr ""
54
 
55
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:202
56
  #: ../wordpress-add-custom-css.php:202
57
  msgid "Settings"
58
  msgstr ""
59
+
60
+ #: ../wordpress-add-custom-css.php:95
61
+ msgid "Add Custom CSS"
62
+ msgstr ""
63
+
64
+ #: ../wordpress-add-custom-css.php:132
65
+ msgid "Main CSS"
66
+ msgstr ""
67
+
68
+ #: ../wordpress-add-custom-css.php:138
69
+ msgid "CSS rules"
70
+ msgstr ""
languages/en.pot CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Wordpress Add Custom CSS\n"
4
- "POT-Creation-Date: 2014-10-04 16:46+0100\n"
5
- "PO-Revision-Date: 2014-10-04 16:46+0100\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: en\n"
@@ -16,34 +16,55 @@ msgstr ""
16
  "X-Poedit-KeywordsList: __;_e\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
 
19
  #: ../wordpress-add-custom-css.php:62
20
  msgid "Custom CSS"
21
  msgstr ""
22
 
23
- #: ../wordpress-add-custom-css.php:88
24
- msgid "Add custom CSS rules for this "
 
 
25
  msgstr ""
26
 
27
- #: ../wordpress-add-custom-css.php:101
 
28
  msgid "Wordpress Add Custom CSS"
29
  msgstr ""
30
 
31
- #: ../wordpress-add-custom-css.php:105
 
32
  msgid "Save"
33
  msgstr ""
34
 
35
- #: ../wordpress-add-custom-css.php:107
 
36
  msgid "Credits"
37
  msgstr ""
38
 
39
- #: ../wordpress-add-custom-css.php:109
 
40
  msgid "\"WP Add Custom CSS\" is a plugin by"
41
  msgstr ""
42
 
43
- #: ../wordpress-add-custom-css.php:116
 
44
  msgid "Write here the CSS rules you want to apply to the whole website."
45
  msgstr ""
46
 
 
47
  #: ../wordpress-add-custom-css.php:202
48
  msgid "Settings"
49
  msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Wordpress Add Custom CSS\n"
4
+ "POT-Creation-Date: 2015-05-10 19:07+0100\n"
5
+ "PO-Revision-Date: 2015-05-10 19:08+0100\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: en\n"
16
  "X-Poedit-KeywordsList: __;_e\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:62
20
  #: ../wordpress-add-custom-css.php:62
21
  msgid "Custom CSS"
22
  msgstr ""
23
 
24
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:89
25
+ #: ../wordpress-add-custom-css.php:89
26
+ #, php-format
27
+ msgid "Add custom CSS rules for this %s"
28
  msgstr ""
29
 
30
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:102
31
+ #: ../wordpress-add-custom-css.php:95 ../wordpress-add-custom-css.php:102
32
  msgid "Wordpress Add Custom CSS"
33
  msgstr ""
34
 
35
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:106
36
+ #: ../wordpress-add-custom-css.php:106
37
  msgid "Save"
38
  msgstr ""
39
 
40
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:108
41
+ #: ../wordpress-add-custom-css.php:108
42
  msgid "Credits"
43
  msgstr ""
44
 
45
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:110
46
+ #: ../wordpress-add-custom-css.php:110
47
  msgid "\"WP Add Custom CSS\" is a plugin by"
48
  msgstr ""
49
 
50
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:117
51
+ #: ../wordpress-add-custom-css.php:117
52
  msgid "Write here the CSS rules you want to apply to the whole website."
53
  msgstr ""
54
 
55
+ #: ../wordpress-add-custom-css - TEST CUSTOM POST TYPE.php:202
56
  #: ../wordpress-add-custom-css.php:202
57
  msgid "Settings"
58
  msgstr ""
59
+
60
+ #: ../wordpress-add-custom-css.php:95
61
+ msgid "Add Custom CSS"
62
+ msgstr ""
63
+
64
+ #: ../wordpress-add-custom-css.php:132
65
+ msgid "Main CSS"
66
+ msgstr ""
67
+
68
+ #: ../wordpress-add-custom-css.php:138
69
+ msgid "CSS rules"
70
+ msgstr ""
languages/wp-add-custom-css-de_DE.mo ADDED
Binary file
languages/wp-add-custom-css-de_DE.po ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Wordpress Add Custom CSS\n"
4
+ "POT-Creation-Date: 2014-10-04 16:46+0100\n"
5
+ "PO-Revision-Date: 2015-04-08 15:25+0100\n"
6
+ "Last-Translator: Bodo Graumann <mail@bodograumann.de>\n"
7
+ "Language-Team: \n"
8
+ "Language: de\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.6.3\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "X-Poedit-KeywordsList: __;_e\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+
19
+ #: ../wordpress-add-custom-css.php:62
20
+ msgid "Custom CSS"
21
+ msgstr "Angepasstes CSS"
22
+
23
+ #: ../wordpress-add-custom-css.php:88
24
+ msgid "Add custom CSS rules for this %s"
25
+ msgstr "Passe %s-Aussehen an"
26
+
27
+ #: ../wordpress-add-custom-css.php:101
28
+ msgid "Wordpress Add Custom CSS"
29
+ msgstr "Angepasstes CSS Hinzufügen"
30
+
31
+ #: ../wordpress-add-custom-css.php:105
32
+ msgid "Save"
33
+ msgstr "Speichern"
34
+
35
+ #: ../wordpress-add-custom-css.php:107
36
+ msgid "Credits"
37
+ msgstr "Authoren"
38
+
39
+ #: ../wordpress-add-custom-css.php:109
40
+ msgid "\"WP Add Custom CSS\" is a plugin by"
41
+ msgstr "\"WP Add Custom CSS\" ist ein Plugin von"
42
+
43
+ #: ../wordpress-add-custom-css.php:116
44
+ msgid "Write here the CSS rules you want to apply to the whole website."
45
+ msgstr "Definiere hier die CSS-Regeln, welche für die gesamte Webseite gelten sollen."
46
+
47
+ #: ../wordpress-add-custom-css.php:202
48
+ msgid "Settings"
49
+ msgstr "Einstellungen"
50
+
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: danieledesantis
3
  Tags: css, custom css, stylesheet, custom stylesheet, single post css, site css, single page css
4
  Requires at least: 4.0
5
- Tested up to: 4.1.1
6
- Stable tag: 0.9.4
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -17,6 +17,11 @@ The CSS rules applied to the whole website will override the default stylesheets
17
  You can edit the main stylesheet from the the "Add custom CSS" settings page.
18
  The plugin also creates a new "Custom CSS" box in the editing area to add custom CSS to specific posts and pages.
19
 
 
 
 
 
 
20
  == Installation ==
21
 
22
  = Automatic installation =
@@ -52,6 +57,9 @@ Click on the "Screen option" link from your post/page editing area and be sure t
52
 
53
  == Changelog ==
54
 
 
 
 
55
  = 0.9.4 =
56
  * Fixed &gt; rendering issue
57
 
@@ -70,6 +78,9 @@ Click on the "Screen option" link from your post/page editing area and be sure t
70
 
71
  == Upgrade Notice ==
72
 
 
 
 
73
  = 0.9.4 =
74
  * Fixed &gt; rendering issue
75
 
2
  Contributors: danieledesantis
3
  Tags: css, custom css, stylesheet, custom stylesheet, single post css, site css, single page css
4
  Requires at least: 4.0
5
+ Tested up to: 4.2.2
6
+ Stable tag: 0.9.5
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
17
  You can edit the main stylesheet from the the "Add custom CSS" settings page.
18
  The plugin also creates a new "Custom CSS" box in the editing area to add custom CSS to specific posts and pages.
19
 
20
+ Available languages:
21
+
22
+ - English
23
+ - German - thanks to <a href="http://bodograumann.de/" target="_blank">Bodo Graumann</a>
24
+
25
  == Installation ==
26
 
27
  = Automatic installation =
57
 
58
  == Changelog ==
59
 
60
+ = 0.9.5 =
61
+ * Improved css output for single posts and pages
62
+
63
  = 0.9.4 =
64
  * Fixed &gt; rendering issue
65
 
78
 
79
  == Upgrade Notice ==
80
 
81
+ = 0.9.5 =
82
+ * Improved css output for single posts and pages
83
+
84
  = 0.9.4 =
85
  * Fixed &gt; rendering issue
86
 
wordpress-add-custom-css.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Add Custom CSS
4
  Plugin URI: http://www.danieledesantis.net
5
  Description: Add custom css to the whole website and to specific posts and pages.
6
- Version: 0.9.4
7
  Author: Daniele De Santis
8
  Author URI: http://www.danieledesantis.net
9
  Text Domain: wp-add-custom-css
@@ -36,16 +36,16 @@ if(!class_exists('Wpacc'))
36
  {
37
  private $options;
38
 
39
- public function __construct() {
40
- add_action('admin_menu', array($this, 'add_menu'));
41
- add_action( 'admin_init', array( $this, 'init_settings' ) );
42
  add_action( 'add_meta_boxes', array($this, 'add_meta_box' ) );
43
  add_action( 'save_post', array( $this, 'single_save' ) );
44
  add_action('init', array($this, 'init'));
45
  add_filter('query_vars', array($this, 'add_wp_var'));
46
  add_action( 'wp_enqueue_scripts', array($this, 'add_custom_css'), 999 );
47
  add_action('wp_head', array($this, 'single_custom_css'));
48
- }
49
 
50
  public function init() {
51
  load_plugin_textdomain( 'wp-add-custom-css', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
@@ -54,13 +54,13 @@ if(!class_exists('Wpacc'))
54
  public static function uninstall() {
55
  self::delete_options();
56
  self::delete_custom_meta();
57
- }
58
 
59
  public function add_meta_box( $post_type ) {
60
  $post_types = array('post', 'page');
61
- if ( in_array( $post_type, $post_types )) {
62
- add_meta_box('wp_add_custom_css', __( 'Custom CSS', 'wp-add-custom-css' ), array( $this, 'render_meta_box_content' ), $post_type, 'advanced', 'high');
63
- }
64
  }
65
 
66
  public function single_save( $post_id ) {
@@ -78,30 +78,30 @@ if(!class_exists('Wpacc'))
78
  return;
79
  }
80
 
81
- $single_custom_css = sanitize_text_field( $_POST['single_custom_css'] );
82
  update_post_meta( $post_id, '_single_add_custom_css', $single_custom_css );
83
  }
84
 
85
  public function render_meta_box_content( $post ) {
86
  wp_nonce_field( 'single_add_custom_css_box', 'wp_add_custom_css_box_nonce' );
87
- $single_custom_css = get_post_meta( $post->ID, '_single_add_custom_css', true );
88
- echo '<p>'. __( 'Add custom CSS rules for this ' . $post->post_type, 'wp-add-custom-css' ) . '</p> ';
89
  echo '<textarea id="single_custom_css" name="single_custom_css" style="width:100%; min-height:200px;">' . esc_attr( $single_custom_css ) . '</textarea>';
90
  }
91
 
92
  public function add_menu() {
93
  global $wpacc_settings_page;
94
- $wpacc_settings_page = add_menu_page('Wordpress Add Custom CSS', 'Add Custom CSS', 'manage_options', 'wp-add-custom-css_settings', array($this, 'create_settings_page'), plugin_dir_url( __FILE__ ) . '/images/icon.png');
95
  }
96
 
97
  public function create_settings_page() {
98
  $this->options = get_option( 'wpacc_settings' );
99
  ?>
100
  <div class="wrap">
101
- <h2><?php echo __('Wordpress Add Custom CSS', 'wp-add-custom-css'); ?></h2>
102
- <form id="worpress_custom_css_form" method="post" action="options.php">
103
- <?php settings_fields( 'wpacc_group' ); ?>
104
- <?php do_settings_sections( 'wp-add-custom-css_settings' ); ?>
105
  <?php submit_button( __('Save', 'wp-add-custom-css') ); ?>
106
  </form>
107
  <h3><?php echo __('Credits', 'wp-add-custom-css'); ?></h3>
@@ -109,17 +109,17 @@ if(!class_exists('Wpacc'))
109
  <li><?php echo __('"WP Add Custom CSS" is a plugin by', 'wp-add-custom-css'); ?> <a href="http://www.danieledesantis.net/" target="_blank" title="Daniele De Santis">Daniele De Santis</a></li>
110
  </ul>
111
  </div>
112
- <?php
113
  }
114
 
115
  public function print_section_info() {
116
- echo __('Write here the CSS rules you want to apply to the whole website.', 'wp-add-custom-css');
117
- }
118
 
119
  public function main_css_input() {
120
- $custom_rules = isset( $this->options['main_custom_style'] ) ? esc_attr( $this->options['main_custom_style'] ) : '';
121
  echo '<textarea name="wpacc_settings[main_custom_style]" style="width:100%; min-height:300px;">' . $custom_rules . '</textarea>';
122
- }
123
 
124
  public function init_settings() {
125
  register_setting(
@@ -127,18 +127,18 @@ if(!class_exists('Wpacc'))
127
  'wpacc_settings'
128
  );
129
  add_settings_section(
130
- 'wpacc_main_style',
131
- 'Main CSS',
132
- array( $this, 'print_section_info' ),
133
- 'wp-add-custom-css_settings'
134
- );
135
- add_settings_field(
136
- 'main_custom_style',
137
- 'CSS rules',
138
- array( $this, 'main_css_input' ),
139
- 'wp-add-custom-css_settings',
140
- 'wpacc_main_style'
141
- );
142
  }
143
 
144
  public function delete_options() {
@@ -154,16 +154,16 @@ if(!class_exists('Wpacc'))
154
  }
155
 
156
  public static function add_wp_var($public_query_vars) {
157
- $public_query_vars[] = 'display_custom_css';
158
- return $public_query_vars;
159
  }
160
 
161
  public static function display_custom_css(){
162
- $display_css = get_query_var('display_custom_css');
163
- if ($display_css == 'css'){
164
  include_once (plugin_dir_path( __FILE__ ) . '/css/custom-css.php');
165
- exit;
166
- }
167
  }
168
 
169
  public function add_custom_css() {
@@ -179,12 +179,13 @@ if(!class_exists('Wpacc'))
179
  global $post;
180
  $single_custom_css = get_post_meta( $post->ID, '_single_add_custom_css', true );
181
  if ( $single_custom_css !== '' ) {
182
- $output = "<style type=\"text/css\">" . $single_custom_css . "</style>\n";
 
183
  echo $output;
184
  }
185
  }
186
  }
187
-
188
 
189
  }
190
  }
3
  Plugin Name: WP Add Custom CSS
4
  Plugin URI: http://www.danieledesantis.net
5
  Description: Add custom css to the whole website and to specific posts and pages.
6
+ Version: 0.9.5
7
  Author: Daniele De Santis
8
  Author URI: http://www.danieledesantis.net
9
  Text Domain: wp-add-custom-css
36
  {
37
  private $options;
38
 
39
+ public function __construct() {
40
+ add_action('admin_menu', array($this, 'add_menu'));
41
+ add_action( 'admin_init', array( $this, 'init_settings' ) );
42
  add_action( 'add_meta_boxes', array($this, 'add_meta_box' ) );
43
  add_action( 'save_post', array( $this, 'single_save' ) );
44
  add_action('init', array($this, 'init'));
45
  add_filter('query_vars', array($this, 'add_wp_var'));
46
  add_action( 'wp_enqueue_scripts', array($this, 'add_custom_css'), 999 );
47
  add_action('wp_head', array($this, 'single_custom_css'));
48
+ }
49
 
50
  public function init() {
51
  load_plugin_textdomain( 'wp-add-custom-css', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
54
  public static function uninstall() {
55
  self::delete_options();
56
  self::delete_custom_meta();
57
+ }
58
 
59
  public function add_meta_box( $post_type ) {
60
  $post_types = array('post', 'page');
61
+ if ( in_array( $post_type, $post_types )) {
62
+ add_meta_box('wp_add_custom_css', __( 'Custom CSS', 'wp-add-custom-css' ), array( $this, 'render_meta_box_content' ), $post_type, 'advanced', 'high');
63
+ }
64
  }
65
 
66
  public function single_save( $post_id ) {
78
  return;
79
  }
80
 
81
+ $single_custom_css = wp_kses( $_POST['single_custom_css'], array( '\'', '\"' ) );
82
  update_post_meta( $post_id, '_single_add_custom_css', $single_custom_css );
83
  }
84
 
85
  public function render_meta_box_content( $post ) {
86
  wp_nonce_field( 'single_add_custom_css_box', 'wp_add_custom_css_box_nonce' );
87
+ $single_custom_css = get_post_meta( $post->ID, '_single_add_custom_css', true );
88
+ echo '<p>'. sprintf( __( 'Add custom CSS rules for this %s', 'wp-add-custom-css' ), $post->post_type ). '</p> ';
89
  echo '<textarea id="single_custom_css" name="single_custom_css" style="width:100%; min-height:200px;">' . esc_attr( $single_custom_css ) . '</textarea>';
90
  }
91
 
92
  public function add_menu() {
93
  global $wpacc_settings_page;
94
+ $wpacc_settings_page = add_menu_page( __('Wordpress Add Custom CSS', 'wp-add-custom-css'), __('Add Custom CSS', 'wp-add-custom-css'), 'manage_options', 'wp-add-custom-css_settings', array($this, 'create_settings_page'), plugin_dir_url( __FILE__ ) . '/images/icon.png');
95
  }
96
 
97
  public function create_settings_page() {
98
  $this->options = get_option( 'wpacc_settings' );
99
  ?>
100
  <div class="wrap">
101
+ <h2><?php echo __('Wordpress Add Custom CSS', 'wp-add-custom-css'); ?></h2>
102
+ <form id="worpress_custom_css_form" method="post" action="options.php">
103
+ <?php settings_fields( 'wpacc_group' ); ?>
104
+ <?php do_settings_sections( 'wp-add-custom-css_settings' ); ?>
105
  <?php submit_button( __('Save', 'wp-add-custom-css') ); ?>
106
  </form>
107
  <h3><?php echo __('Credits', 'wp-add-custom-css'); ?></h3>
109
  <li><?php echo __('"WP Add Custom CSS" is a plugin by', 'wp-add-custom-css'); ?> <a href="http://www.danieledesantis.net/" target="_blank" title="Daniele De Santis">Daniele De Santis</a></li>
110
  </ul>
111
  </div>
112
+ <?php
113
  }
114
 
115
  public function print_section_info() {
116
+ echo __('Write here the CSS rules you want to apply to the whole website.', 'wp-add-custom-css');
117
+ }
118
 
119
  public function main_css_input() {
120
+ $custom_rules = isset( $this->options['main_custom_style'] ) ? esc_attr( $this->options['main_custom_style'] ) : '';
121
  echo '<textarea name="wpacc_settings[main_custom_style]" style="width:100%; min-height:300px;">' . $custom_rules . '</textarea>';
122
+ }
123
 
124
  public function init_settings() {
125
  register_setting(
127
  'wpacc_settings'
128
  );
129
  add_settings_section(
130
+ 'wpacc_main_style',
131
+ __('Main CSS', 'wp-add-custom-css'),
132
+ array( $this, 'print_section_info' ),
133
+ 'wp-add-custom-css_settings'
134
+ );
135
+ add_settings_field(
136
+ 'main_custom_style',
137
+ __('CSS rules', 'wp-add-custom-css'),
138
+ array( $this, 'main_css_input' ),
139
+ 'wp-add-custom-css_settings',
140
+ 'wpacc_main_style'
141
+ );
142
  }
143
 
144
  public function delete_options() {
154
  }
155
 
156
  public static function add_wp_var($public_query_vars) {
157
+ $public_query_vars[] = 'display_custom_css';
158
+ return $public_query_vars;
159
  }
160
 
161
  public static function display_custom_css(){
162
+ $display_css = get_query_var('display_custom_css');
163
+ if ($display_css == 'css'){
164
  include_once (plugin_dir_path( __FILE__ ) . '/css/custom-css.php');
165
+ exit;
166
+ }
167
  }
168
 
169
  public function add_custom_css() {
179
  global $post;
180
  $single_custom_css = get_post_meta( $post->ID, '_single_add_custom_css', true );
181
  if ( $single_custom_css !== '' ) {
182
+ $single_custom_css = str_replace ( '&gt;' , '>' , $single_custom_css );
183
+ $output = "<style type=\"text/css\">\n" . $single_custom_css . "\n</style>\n";
184
  echo $output;
185
  }
186
  }
187
  }
188
+
189
 
190
  }
191
  }