Per page add to head - Version 1.1.2

Version Description

  • Changes the output order to global content first, then page specific content.
  • Moves the per page add to head output down the queue on the wp_head hook, so the content is inserted at the end of the head tag
Download this release

Release Info

Developer Erikvona
Plugin Icon wp plugin Per page add to head
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.2

Files changed (2) hide show
  1. perpagehead.php +8 -7
  2. readme.txt +7 -3
perpagehead.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Per page head
5
  Plugin URI: http://www.evona.nl/plugins/per-page-head
6
  Description: Allows you to add content into the <head> section for a specific page, like custom JS or custom HTML, using post meta. Also allows you to add content for every page, under Settings -> add <head> to every page
7
- Version: 1.1.1
8
  Author: Erik von Asmuth
9
  Author URI: http://evona.nl/about-me/
10
  License: GPLv2
@@ -91,11 +91,7 @@ add_action( 'save_post', 'perpageath_save_postdata' );
91
  //Now that's done. Let's add the meta field to the head
92
 
93
  function perpageath_display(){
94
- $pageid = get_queried_object_id();
95
- $addtoheadcontent = get_post_meta( $pageid, 'per-page-ath-content', true );
96
- if(!empty($addtoheadcontent)){
97
- echo str_replace('%BREAK%', "\n", stripslashes_deep($addtoheadcontent));
98
- }
99
  $htmlfile = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'evonapluginconfig'.DIRECTORY_SEPARATOR.'everyheadpage.html';
100
  if(file_exists($htmlfile)&& filesize($htmlfile) > 0){
101
  if($htmlhandle = fopen($htmlfile, 'r')){
@@ -106,8 +102,13 @@ function perpageath_display(){
106
  echo "<!-- ".printf( __( 'Error reading config file %s! Is this file readable by the webserver?', 'per-page-ath' ), $htmlfile )." -->";
107
  }
108
  }
 
 
 
 
 
109
  }
110
- add_action('wp_head', 'perpageath_display');
111
 
112
  //Create a menu
113
  //Load in the option page
4
  Plugin Name: Per page head
5
  Plugin URI: http://www.evona.nl/plugins/per-page-head
6
  Description: Allows you to add content into the &lt;head&gt; section for a specific page, like custom JS or custom HTML, using post meta. Also allows you to add content for every page, under Settings -> add &lt;head&gt; to every page
7
+ Version: 1.1.2
8
  Author: Erik von Asmuth
9
  Author URI: http://evona.nl/about-me/
10
  License: GPLv2
91
  //Now that's done. Let's add the meta field to the head
92
 
93
  function perpageath_display(){
94
+ $pageid = get_queried_object_id();
 
 
 
 
95
  $htmlfile = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'evonapluginconfig'.DIRECTORY_SEPARATOR.'everyheadpage.html';
96
  if(file_exists($htmlfile)&& filesize($htmlfile) > 0){
97
  if($htmlhandle = fopen($htmlfile, 'r')){
102
  echo "<!-- ".printf( __( 'Error reading config file %s! Is this file readable by the webserver?', 'per-page-ath' ), $htmlfile )." -->";
103
  }
104
  }
105
+ $addtoheadcontent = get_post_meta( $pageid, 'per-page-ath-content', true );
106
+ if(!empty($addtoheadcontent)){
107
+ echo str_replace('%BREAK%', "\n", stripslashes_deep($addtoheadcontent));
108
+ }
109
+
110
  }
111
+ add_action('wp_head', 'perpageath_display', 1000);
112
 
113
  //Create a menu
114
  //Load in the option page
readme.txt CHANGED
@@ -2,11 +2,11 @@
2
  Contributors: Erikvona
3
  Plugin Name: Per page add to head
4
  Tags: head, css, favicon
5
- Author URI: http://evona.com/over-mij
6
  Author: Erik von Asmuth (Erikvona)
7
  Requires at least: 3.5
8
- Tested up to: 3.9
9
- Stable tag: 1.1
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -36,6 +36,10 @@ Installation is plain and simple
36
 
37
  == Changelog ==
38
 
 
 
 
 
39
  = 1.1.1 =
40
  - Includes spanish translation thanks to Andrew Kurtis from WebHostingHub
41
 
2
  Contributors: Erikvona
3
  Plugin Name: Per page add to head
4
  Tags: head, css, favicon
5
+ Author URI: http://evona.nl/over-mij
6
  Author: Erik von Asmuth (Erikvona)
7
  Requires at least: 3.5
8
+ Tested up to: 4.1
9
+ Stable tag: 1.1.2
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
36
 
37
  == Changelog ==
38
 
39
+ = 1.1.2 =
40
+ - Changes the output order to global content first, then page specific content.
41
+ - Moves the per page add to head output down the queue on the wp_head hook, so the content is inserted at the end of the head tag
42
+
43
  = 1.1.1 =
44
  - Includes spanish translation thanks to Andrew Kurtis from WebHostingHub
45