Head & Footer Code - Version 1.0.7

Version Description

  • Compatibility check: Tested for WordPress 4.7.1
  • UX: Add right hand sidebar on global settings page with links to donate, FAQ, Community support and plugin Reviews page.
  • UX: Set monospaced font for textareas on global settings and article pages
Download this release

Release Info

Developer urkekg
Plugin Icon Head & Footer Code
Version 1.0.7
Comparing to
See all releases

Code changes from version 1.0.6 to 1.0.7

assets/css/admin.css ADDED
@@ -0,0 +1,2 @@
1
+ #head_footer_code_settings .head_footer_code_wrapper{display:table}#head_footer_code_settings .head_footer_code_wrapper .content_cell{display:table-cell}#head_footer_code_settings .head_footer_code_wrapper .sidebar_container{display:table-cell;padding:0 0 0 20px;width:25%}#head_footer_code_settings .head_footer_code_wrapper .sidebar_container .auhfc-button{display:block;background:#fff;border-radius:7px;border:1px solid rgba(0,0,0,0.1);box-shadow:0 0 0 5px rgba(0,0,0,0.1);padding:11px 15px;white-space:nowrap;line-height:18px;color:#bdbdbd;text-shadow:1px 1px #fff;text-decoration:none;position:relative;min-width:120px}#head_footer_code_settings .head_footer_code_wrapper .sidebar_container .auhfc-button:hover{color:#6796a9;background-color:#c2edff}#head_footer_code_settings .head_footer_code_wrapper .sidebar_container .auhfc-button.paypal_donate:after{content:' ';background-image:url(../img/paypal.png);background-repeat:no-repeat;background-position:center right;width:62px;height:100%;display:inline-block;position:absolute;right:15px;top:0;bottom:0}
2
+ /*# sourceMappingURL=admin.css.map */
assets/css/admin.css.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "mappings": "AACI,oDAA0B,CACtB,OAAO,CAAE,KAAK,CAEd,kEAAc,CACV,OAAO,CAAE,UAAU,CAGvB,uEAAmB,CACf,OAAO,CAAE,UAAU,CACnB,OAAO,CAAE,UAAU,CACnB,KAAK,CAAE,GAAG,CAEV,qFAAc,CACV,OAAO,CAAE,KAAK,CACd,UAAU,CAAE,IAAI,CAChB,aAAa,CAAE,GAAG,CAClB,MAAM,CAAE,yBAAyB,CACjC,UAAU,CAAE,yBAAyB,CACrC,OAAO,CAAE,SAAS,CAClB,WAAW,CAAE,MAAM,CACnB,WAAW,CAAE,IAAI,CACjB,KAAK,CAAE,OAAO,CACd,WAAW,CAAE,YAAY,CACzB,eAAe,CAAE,IAAI,CACrB,QAAQ,CAAE,QAAQ,CAClB,SAAS,CAAE,KAAK,CAEhB,2FAAQ,CACJ,KAAK,CAAE,OAAO,CACd,gBAAgB,CAAE,OAAO,CAG7B,yGAAsB,CAClB,OAAO,CAAE,GAAG,CACZ,gBAAgB,CAAE,sBAAsB,CACxC,iBAAiB,CAAE,SAAS,CAC5B,mBAAmB,CAAE,YAAY,CACjC,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,OAAO,CAAE,YAAY,CACrB,QAAQ,CAAE,QAAQ,CAClB,KAAK,CAAE,IAAI,CACX,GAAG,CAAE,CAAC,CACN,MAAM,CAAE,CAAC",
4
+ "sources": ["admin.scss"],
5
+ "names": [],
6
+ "file": "admin.css"
7
+ }
assets/css/admin.scss ADDED
@@ -0,0 +1,50 @@
1
+ #head_footer_code_settings {
2
+ .head_footer_code_wrapper {
3
+ display: table;
4
+
5
+ .content_cell {
6
+ display: table-cell;
7
+ }
8
+
9
+ .sidebar_container {
10
+ display: table-cell;
11
+ padding: 0 0 0 20px;
12
+ width: 25%;
13
+
14
+ .auhfc-button {
15
+ display: block;
16
+ background: #fff;
17
+ border-radius: 7px;
18
+ border: 1px solid rgba(0,0,0,0.1);
19
+ box-shadow: 0 0 0 5px rgba(0,0,0,0.1);
20
+ padding: 11px 15px;
21
+ white-space: nowrap;
22
+ line-height: 18px;
23
+ color: #bdbdbd;
24
+ text-shadow: 1px 1px #fff;
25
+ text-decoration: none;
26
+ position: relative;
27
+ min-width: 120px;
28
+
29
+ &:hover {
30
+ color: #6796a9;
31
+ background-color: #c2edff;
32
+ }
33
+
34
+ &.paypal_donate:after {
35
+ content: ' ';
36
+ background-image: url(../img/paypal.png);
37
+ background-repeat: no-repeat;
38
+ background-position: center right;
39
+ width: 62px;
40
+ height: 100%;
41
+ display: inline-block;
42
+ position: absolute;
43
+ right: 15px;
44
+ top: 0;
45
+ bottom: 0;
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
assets/img/paypal.png ADDED
Binary file
head-footer-code.php CHANGED
@@ -8,7 +8,7 @@
8
* Plugin Name: Head & Footer Code
9
* Plugin URI: https://urosevic.net/wordpress/plugins/head-footer-code/
10
* Description: Easy add site-wide and/or article specific custom code to head and/or footer sections (before the &lt;/head&gt; or &lt;/body&gt;) by hooking to <code>wp_head</code> and <code>wp_footer</code>. Support Multisite environment.
11
- * Version: 1.0.6
12
* Author: Aleksandar Urosevic
13
* Author URI: https://urosevic.net
14
* License: GPL-2.0+
@@ -22,6 +22,8 @@ if ( ! defined( 'WPINC' ) ) {
22
die;
23
}
24
25
// Load files.
26
require_once 'inc/helpers.php';
27
if ( is_admin() ) {
8
* Plugin Name: Head & Footer Code
9
* Plugin URI: https://urosevic.net/wordpress/plugins/head-footer-code/
10
* Description: Easy add site-wide and/or article specific custom code to head and/or footer sections (before the &lt;/head&gt; or &lt;/body&gt;) by hooking to <code>wp_head</code> and <code>wp_footer</code>. Support Multisite environment.
11
+ * Version: 1.0.7
12
* Author: Aleksandar Urosevic
13
* Author URI: https://urosevic.net
14
* License: GPL-2.0+
22
die;
23
}
24
25
+ define( 'WPAU_HEAD_FOOTER_CODE_VER', '1.0.7' );
26
+
27
// Load files.
28
require_once 'inc/helpers.php';
29
if ( is_admin() ) {
inc/metaboxes.php CHANGED
@@ -63,7 +63,7 @@ function auhfc_display_html( $post ) {
63
<label for="auhfc_head"><?php _e( 'Head Code', 'head-footer-code' ); ?></label>
64
</th>
65
<td>
66
- <textarea name="auhfc[head]" id="auhfc_head" class="widefat" rows="5"><?php echo auhfc_get_meta( 'head' ); ?></textarea>
67
<p>Example: <code>&lt;link rel="stylesheet" href="https://domain.com/path/to/style.css" type="text/css" media="all"&gt;</code></p>
68
</td>
69
</tr>
@@ -72,7 +72,7 @@ function auhfc_display_html( $post ) {
72
<label for="auhfc_footer"><?php _e( 'Footer Code', 'head-footer-code' ); ?></label>
73
</th>
74
<td>
75
- <textarea name="auhfc[footer]" id="auhfc_footer" class="widefat" rows="5"><?php echo auhfc_get_meta( 'footer' ); ?></textarea>
76
<p>Example: <code>&lt;script type="text/javascript" src="http://domain.com/path/to/script.js"&gt;&lt;/script&gt;</code></p>
77
</td>
78
</tr>
63
<label for="auhfc_head"><?php _e( 'Head Code', 'head-footer-code' ); ?></label>
64
</th>
65
<td>
66
+ <textarea name="auhfc[head]" id="auhfc_head" class="widefat code" rows="5"><?php echo auhfc_get_meta( 'head' ); ?></textarea>
67
<p>Example: <code>&lt;link rel="stylesheet" href="https://domain.com/path/to/style.css" type="text/css" media="all"&gt;</code></p>
68
</td>
69
</tr>
72
<label for="auhfc_footer"><?php _e( 'Footer Code', 'head-footer-code' ); ?></label>
73
</th>
74
<td>
75
+ <textarea name="auhfc[footer]" id="auhfc_footer" class="widefat code" rows="5"><?php echo auhfc_get_meta( 'footer' ); ?></textarea>
76
<p>Example: <code>&lt;script type="text/javascript" src="http://domain.com/path/to/script.js"&gt;&lt;/script&gt;</code></p>
77
</td>
78
</tr>
inc/settings.php CHANGED
@@ -12,6 +12,23 @@ add_filter( 'plugin_action_links_head-footer-code/head-footer-code.php', 'auhfc_
12
// Update links in plugin row on Plugins page.
13
add_filter( 'plugin_row_meta', 'auhfc_add_plugin_meta_links', 10, 2 );
14
15
function auhfc_add_admin_menu( ) {
16
17
add_submenu_page(
@@ -75,7 +92,7 @@ function auhfc_settings_init( ) {
75
'field' => 'auhfc_settings[head]',
76
'value' => $auhfc_settings['head'],
77
'description' => __( 'Code to enqueue in HEAD section', 'head-footer-code' ),
78
- 'class' => 'widefat',
79
'rows' => 7,
80
)
81
);
@@ -90,7 +107,7 @@ function auhfc_settings_init( ) {
90
'field' => 'auhfc_settings[footer]',
91
'value' => $auhfc_settings['footer'],
92
'description' => esc_html__( 'Code to enqueue in footer section (before the </body>)', 'head-footer-code' ),
93
- 'class' => 'widefat',
94
'rows' => 7,
95
)
96
);
@@ -159,7 +176,7 @@ function auhfc_textarea_field_render( $args ) {
159
'<textarea name="%1$s" id="%1$s" rows="%2$s" class="%3$s">%4$s</textarea><p class="description">%5$s</p>',
160
$field,
161
$rows,
162
- $class,
163
$value,
164
$description
165
);
@@ -230,26 +247,11 @@ function auhfc_article_settings_section_description( ) {
230
} // END function auhfc_article_settings_section_description( )
231
232
function auhfc_options_page( ) {
233
-
234
if ( ! current_user_can( 'manage_options' ) ) {
235
wp_die( esc_attr__( 'You do not have sufficient permissions to access this page.' ) );
236
}
237
-
238
- ?>
239
- <form action='options.php' method='post'>
240
-
241
- <h1>Head &amp; Footer Code</h1>
242
-
243
- <?php
244
- @settings_fields( 'head_footer_code_sitewide_settings' );
245
- @settings_fields( 'head_footer_code_article_settings' );
246
- @do_settings_sections( 'head_footer_code' );
247
- @submit_button();
248
- ?>
249
-
250
- </form>
251
- <?php
252
-
253
}
254
255
/**
12
// Update links in plugin row on Plugins page.
13
add_filter( 'plugin_row_meta', 'auhfc_add_plugin_meta_links', 10, 2 );
14
15
+ // Load admin styles on plugin settings page
16
+ add_action( 'admin_enqueue_scripts', 'auhfc_admin_enqueue_scripts' );
17
+
18
+ /**
19
+ * Enqueue the admin style
20
+ */
21
+ function auhfc_admin_enqueue_scripts($hook) {
22
+ if ( 'tools_page_head_footer_code' == $hook ) {
23
+ wp_enqueue_style(
24
+ 'head-footer-code-admin',
25
+ plugin_dir_url( __FILE__ ) . '../assets/css/admin.css',
26
+ array(),
27
+ WPAU_HEAD_FOOTER_CODE_VER
28
+ );
29
+ }
30
+ } // END function wpau_enqueue_colour_picker()
31
+
32
function auhfc_add_admin_menu( ) {
33
34
add_submenu_page(
92
'field' => 'auhfc_settings[head]',
93
'value' => $auhfc_settings['head'],
94
'description' => __( 'Code to enqueue in HEAD section', 'head-footer-code' ),
95
+ 'field_class' => 'widefat code',
96
'rows' => 7,
97
)
98
);
107
'field' => 'auhfc_settings[footer]',
108
'value' => $auhfc_settings['footer'],
109
'description' => esc_html__( 'Code to enqueue in footer section (before the </body>)', 'head-footer-code' ),
110
+ 'field_class' => 'widefat code',
111
'rows' => 7,
112
)
113
);
176
'<textarea name="%1$s" id="%1$s" rows="%2$s" class="%3$s">%4$s</textarea><p class="description">%5$s</p>',
177
$field,
178
$rows,
179
+ $field_class,
180
$value,
181
$description
182
);
247
} // END function auhfc_article_settings_section_description( )
248
249
function auhfc_options_page( ) {
250
if ( ! current_user_can( 'manage_options' ) ) {
251
wp_die( esc_attr__( 'You do not have sufficient permissions to access this page.' ) );
252
}
253
+ // Render the settings template.
254
+ include( sprintf( '%s/../templates/settings.php', dirname( __FILE__ ) ) );
255
}
256
257
/**
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: urkekg
3
Donate link: https://urosevic.net/wordpress/donate/?donate_for=head-footer-code
4
Tags: wp_head, wp_footer, head footer code, custom head script, custom footer script, google analytics, pixel tracking, tracking code, javascript, scripts, site verification, css
5
Requires at least: 3.9
6
- Tested up to: 4.5
7
- Stable tag: 1.0.6
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -85,6 +85,11 @@ Because all other similar plugins could not satisfy my requirements. In general,
85
Initial release of new plugin developed by Aleksandar Urosevic.
86
87
== Changelog ==
88
= 1.0.6 =
89
* Fix: `PHP Notice: Trying to get property of non-object in \wp-content\plugins\head-footer-code\inc\front.php on line 41`.
90
* Fix: Overwrite footer content for post/page if post/page template after content have another WP Loop query (like recent posts WP Widget in RHS sidebar).
3
Donate link: https://urosevic.net/wordpress/donate/?donate_for=head-footer-code
4
Tags: wp_head, wp_footer, head footer code, custom head script, custom footer script, google analytics, pixel tracking, tracking code, javascript, scripts, site verification, css
5
Requires at least: 3.9
6
+ Tested up to: 4.8
7
+ Stable tag: 1.0.7
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
85
Initial release of new plugin developed by Aleksandar Urosevic.
86
87
== Changelog ==
88
+ = 1.0.7 =
89
+ * Compatibility check: Tested for WordPress 4.7.1
90
+ * UX: Add right hand sidebar on global settings page with links to donate, FAQ, Community support and plugin Reviews page.
91
+ * UX: Set monospaced font for textareas on global settings and article pages
92
+
93
= 1.0.6 =
94
* Fix: `PHP Notice: Trying to get property of non-object in \wp-content\plugins\head-footer-code\inc\front.php on line 41`.
95
* Fix: Overwrite footer content for post/page if post/page template after content have another WP Loop query (like recent posts WP Widget in RHS sidebar).
templates/settings.php ADDED
@@ -0,0 +1,38 @@
1
+ <?php
2
+ /**
3
+ * Head & Footer Code General Settings page template
4
+ *
5
+ * @category Template
6
+ * @package Head & Footer Code
7
+ * @author Aleksandar Urosevic
8
+ * @license https://www.gnu.org/copyleft/gpl.html GNU General Public License
9
+ * @link https://urosevic.net
10
+ */
11
+
12
+ ?>
13
+ <div class="wrap" id="head_footer_code_settings">
14
+ <h1><?php esc_attr_e( 'Head & Footer Code', 'head-footer-code' ); ?></h2>
15
+ <em>Plugin version: <?php echo WPAU_HEAD_FOOTER_CODE_VER; ?></em>
16
+ <div class="head_footer_code_wrapper">
17
+ <div class="content_cell">
18
+ <form method="post" action="options.php">
19
+ <?php
20
+ @settings_fields( 'head_footer_code_sitewide_settings' );
21
+ @settings_fields( 'head_footer_code_article_settings' );
22
+ @do_settings_sections( 'head_footer_code' );
23
+ @submit_button();
24
+ ?>
25
+ </form>
26
+ </div><!-- .content_cell -->
27
+
28
+ <div class="sidebar_container">
29
+ <a href="https://urosevic.net/wordpress/donate/?donate_for=head-footer-code" class="auhfc-button paypal_donate" target="_blank">Donate</a>
30
+ <br />
31
+ <a href="https://wordpress.org/plugins/head-footer-code/faq/" class="auhfc-button" target="_blank">FAQ</a>
32
+ <br />
33
+ <a href="https://wordpress.org/support/plugin/head-footer-code" class="auhfc-button" target="_blank">Community Support</a>
34
+ <br />
35
+ <a href="https://wordpress.org/support/view/plugin-reviews/head-footer-code#postform" class="auhfc-button" target="_blank">Review this plugin</a>
36
+ </div><!-- .sidebar_container -->
37
+ </div><!-- .head_footer_code_wrapper -->
38
+ </div>