Version Description
- Fixed some more errors reintroduced in version 1.4
Download this release
Release Info
Developer | Erikvona |
Plugin | Per page add to head |
Version | 1.4.2 |
Comparing to | |
See all releases |
Code changes from version 1.4.1 to 1.4.2
- perpagehead.php +24 -17
- readme.txt +4 -1
perpagehead.php
CHANGED
@@ -3,21 +3,27 @@
|
|
3 |
Plugin Name: Per page head
|
4 |
Plugin URI: http://www.evona.nl/plugins/per-page-head
|
5 |
Description: Allows you to add content into the <head> section for a specific page, like custom JS or custom HTML
|
6 |
-
Version: 1.4.
|
7 |
Author: Erik von Asmuth
|
8 |
Author URI: http://evona.nl/over-mij/
|
9 |
License: GPLv2
|
|
|
10 |
*/
|
11 |
|
|
|
|
|
|
|
12 |
//Add the meta box
|
13 |
function perpageathaddbox() {
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
19 |
}
|
20 |
-
|
21 |
add_action( 'add_meta_boxes', 'perpageathaddbox' );
|
22 |
|
23 |
function athcallback($post){
|
@@ -34,7 +40,7 @@ function athcallback($post){
|
|
34 |
echo '<label for="per-page-ath">';
|
35 |
_e( "Put your head html here", 'per-page-ath' );
|
36 |
echo '</label><br/> ';
|
37 |
-
echo '<textarea id="perpageathtextbox" style="width:100%;" name="per-page-ath">'.
|
38 |
}
|
39 |
|
40 |
/**
|
@@ -87,13 +93,6 @@ add_action( 'save_post', 'perpageath_save_postdata' );
|
|
87 |
//Now that's done. Let's add the meta field to the head
|
88 |
|
89 |
function perpageath_display(){
|
90 |
-
if(!is_archive()){
|
91 |
-
$pageid = get_queried_object_id();
|
92 |
-
$addtoheadcontent = get_post_meta( $pageid, 'per-page-ath-content', true );
|
93 |
-
if(!empty($addtoheadcontent)){
|
94 |
-
echo do_shortcode(stripslashes_deep($addtoheadcontent));
|
95 |
-
}
|
96 |
-
}
|
97 |
$html = get_option("ppath_head_every_page", "");
|
98 |
if(empty($html)){
|
99 |
$htmlfile = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'evonapluginconfig'.DIRECTORY_SEPARATOR.'everyheadpage.html';
|
@@ -109,13 +108,21 @@ function perpageath_display(){
|
|
109 |
}else{
|
110 |
echo do_shortcode($html);
|
111 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
-
add_action('wp_head', 'perpageath_display');
|
114 |
|
115 |
//Create a menu
|
116 |
//Load in the option page
|
117 |
function EvonaCreateATHMenu() {
|
118 |
-
|
|
|
119 |
}
|
120 |
|
121 |
function PerPageATHSettings(){
|
3 |
Plugin Name: Per page head
|
4 |
Plugin URI: http://www.evona.nl/plugins/per-page-head
|
5 |
Description: Allows you to add content into the <head> section for a specific page, like custom JS or custom HTML
|
6 |
+
Version: 1.4.2
|
7 |
Author: Erik von Asmuth
|
8 |
Author URI: http://evona.nl/over-mij/
|
9 |
License: GPLv2
|
10 |
+
Text Domain: per-page-ath
|
11 |
*/
|
12 |
|
13 |
+
defined( 'ABSPATH' ) or die( 'Direct access not allowed' );
|
14 |
+
load_plugin_textdomain('per-page-ath', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
15 |
+
|
16 |
//Add the meta box
|
17 |
function perpageathaddbox() {
|
18 |
+
if(current_user_can('add-to-head')||current_user_can('manage_options')){
|
19 |
+
$addtohead = __('Add to head', 'per-page-ath');
|
20 |
+
$screens = get_option('ppath_types_allowed', array('post', 'page'));
|
21 |
+
foreach ( $screens as $screen ) {
|
22 |
+
add_meta_box( 'per-page-ath', $addtohead, 'athcallback', $screen, 'normal',
|
23 |
+
'default', null );
|
24 |
+
}
|
25 |
+
}
|
26 |
}
|
|
|
27 |
add_action( 'add_meta_boxes', 'perpageathaddbox' );
|
28 |
|
29 |
function athcallback($post){
|
40 |
echo '<label for="per-page-ath">';
|
41 |
_e( "Put your head html here", 'per-page-ath' );
|
42 |
echo '</label><br/> ';
|
43 |
+
echo '<textarea id="perpageathtextbox" style="width:100%; min-height:120px; white-space: pre-wrap;" name="per-page-ath">'.str_replace('%BREAK%', "\n",stripslashes_deep(esc_attr($value))).'</textarea>';
|
44 |
}
|
45 |
|
46 |
/**
|
93 |
//Now that's done. Let's add the meta field to the head
|
94 |
|
95 |
function perpageath_display(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
$html = get_option("ppath_head_every_page", "");
|
97 |
if(empty($html)){
|
98 |
$htmlfile = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'evonapluginconfig'.DIRECTORY_SEPARATOR.'everyheadpage.html';
|
108 |
}else{
|
109 |
echo do_shortcode($html);
|
110 |
}
|
111 |
+
if(!is_archive()){
|
112 |
+
$pageid = get_queried_object_id();
|
113 |
+
$addtoheadcontent = get_post_meta( $pageid, 'per-page-ath-content', true );
|
114 |
+
if(!empty($addtoheadcontent)){
|
115 |
+
echo do_shortcode(str_replace('%BREAK%', "\n", stripslashes_deep($addtoheadcontent)));
|
116 |
+
}
|
117 |
+
}
|
118 |
}
|
119 |
+
add_action('wp_head', 'perpageath_display', 1000);
|
120 |
|
121 |
//Create a menu
|
122 |
//Load in the option page
|
123 |
function EvonaCreateATHMenu() {
|
124 |
+
$menuname = __('Per Page Add To Head', 'per-page-ath');
|
125 |
+
add_options_page( $menuname, $menuname, 'manage_options', 'perpageath-every-page', 'PerPageATHSettings' );
|
126 |
}
|
127 |
|
128 |
function PerPageATHSettings(){
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Author URI: http://evona.nl/over-mij
|
|
6 |
Author: Erik von Asmuth (Erikvona)
|
7 |
Requires at least: 3.5
|
8 |
Tested up to: 4.7
|
9 |
-
Stable tag: 1.4.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -35,6 +35,9 @@ Installation is plain and simple
|
|
35 |
1. You can also add head to all posts! Just use settings -> per page add to head
|
36 |
|
37 |
== Changelog ==
|
|
|
|
|
|
|
38 |
= 1.4.1 =
|
39 |
- Fixed an error leading to incorrect new line storage
|
40 |
|
6 |
Author: Erik von Asmuth (Erikvona)
|
7 |
Requires at least: 3.5
|
8 |
Tested up to: 4.7
|
9 |
+
Stable tag: 1.4.2
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
35 |
1. You can also add head to all posts! Just use settings -> per page add to head
|
36 |
|
37 |
== Changelog ==
|
38 |
+
= 1.4.2 =
|
39 |
+
- Fixed some more errors reintroduced in version 1.4
|
40 |
+
|
41 |
= 1.4.1 =
|
42 |
- Fixed an error leading to incorrect new line storage
|
43 |
|