Meta Tag Manager - Version 0.2

Version Description

Download this release

Release Info

Developer netweblogic
Plugin Icon 128x128 Meta Tag Manager
Version 0.2
Comparing to
See all releases

Version 0.2

Files changed (4) hide show
  1. meta-tag-manager.php +127 -0
  2. mtm_script.js +61 -0
  3. readme.txt +44 -0
  4. screenshot-1.jpg +0 -0
meta-tag-manager.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Meta Tag Manager
4
+ Plugin URI: http://blog.netweblogic.com/php/wordpress-php/meta-tag-manager-wordpress-plugin/
5
+ Description: A simple plugin to manage meta tags that appear on all your pages. This can be used for verifiying google, yahoo, and more.
6
+ Author: NetWebLogic LLC
7
+ Stable tag: 0.2
8
+ Author URI: http://blog.netweblogic.com
9
+ */
10
+ /*
11
+ Copyright (C) 2008 NetWebLogic LLC
12
+
13
+ This program is free software; you can redistribute it and/or modify
14
+ it under the terms of the GNU General Public License as published by
15
+ the Free Software Foundation; either version 3 of the License, or
16
+ (at your option) any later version.
17
+
18
+ This program is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
25
+ */
26
+ // Hook for adding admin menus
27
+ add_action('admin_menu', 'mtm_add_pages');
28
+
29
+ // action function for above hook
30
+ function mtm_add_pages() {
31
+ $page = add_options_page('Meta Tag Manager', 'Meta Tag Manager', 8, 'mtmverification', 'mtm_options');
32
+ add_action("admin_print_scripts-$page", 'mtm_list_scripts');
33
+ }
34
+
35
+ function mtm_list_scripts( ) {
36
+ wp_enqueue_script( "meta-tag-manager", path_join(WP_PLUGIN_URL, basename( dirname( __FILE__ ) )."/mtm_script.js"), array( 'jquery' ) );
37
+ }
38
+
39
+ function mtm_options() {
40
+ add_option('mtm_data');
41
+ $mtm_data = array();
42
+
43
+ if( is_admin() and $_POST['mtm_submitted']==1 ){
44
+ for($i=1 ; trim($_POST["mtm_{$i}_ref"])!='' ; $i++ ){
45
+ if(trim($_POST["mtm_{$i}_name"]) != '' and trim($_POST["mtm_{$i}_content"]) != ''){
46
+ $mtm_data[$_POST["mtm_{$i}_ref"]] = array($_POST["mtm_{$i}_name"], $_POST["mtm_{$i}_content"]);
47
+ }
48
+ }
49
+ update_option('mtm_data', $mtm_data);
50
+ ?>
51
+ <div class="updated"><p><strong><?php _e('Options saved.', 'mt_trans_domain' ); ?></strong></p></div>
52
+ <?php
53
+ }else{
54
+ $mtm_data = get_option('mtm_data');
55
+ }
56
+ ?>
57
+ <div class="wrap">
58
+ <h2>Meta Tag Manager</h2>
59
+ <p>Enter a reference name (something to help you remember the meta tag) and then enter the values that you want the meta tag to hold.</p>
60
+ <form method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
61
+ <table class="form-table">
62
+ <thead>
63
+ <tr valign="top">
64
+ <td><strong>Reference Name</strong></td>
65
+ <td><strong>Meta Tag</strong></td>
66
+ </tr>
67
+ </thead>
68
+ <tbody id="mtm_body">
69
+ <?php
70
+ $count = 1;
71
+ if( is_array($mtm_data) and count($mtm_data) > 0){
72
+ foreach( $mtm_data as $name => $meta){
73
+ ?>
74
+ <tr valign="top" id="mtm_<?= $count ?>">
75
+ <td scope="row"><input type="text" name="mtm_<?= $count ?>_ref" value="<?= $name ?>" /> <a href="#" rel="<?= $count ?>">Remove</a></td>
76
+ <td>&lt;meta name="<input type="text" name="mtm_<?= $count ?>_name" value="<?= $meta[0] ?>" />" content="<input type="text" name="mtm_<?= $count ?>_content" value="<?= $meta[1] ?>" />" /&gt;</td>
77
+ </tr>
78
+ <?php
79
+ $count++;
80
+ }
81
+ }else{
82
+ ?>
83
+ <tr valign="top" id="mtm_<?= $count ?>">
84
+ <td scope="row"><input type="text" name="mtm_<?= $count ?>_ref" value="<?= $name ?>" /> <a href="#" rel="<?= $count ?>">Remove</a></td>
85
+ <td>&lt;meta name="<input type="text" name="mtm_<?= $count ?>_name" value="<?= $meta[0] ?>" />" content="<input type="text" name="mtm_<?= $count ?>_content" value="<?= $meta[1] ?>" />" /&gt;</td>
86
+ </tr>
87
+ <?php
88
+ }
89
+ ?>
90
+ </tbody>
91
+ <tfoot>
92
+ <tr valign="top">
93
+ <td colspan="3"><a href="#" id="mtm_add_tag">Add new tag</a></td>
94
+ </tr>
95
+ </tfoot>
96
+ </table>
97
+
98
+ <input type="hidden" name="mtm_submitted" value="1" />
99
+ <p class="submit">
100
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
101
+ </p>
102
+ </form>
103
+ </div>
104
+ <?php
105
+ }
106
+ add_action('init', 'mtm_head');
107
+ add_action('wp_head', 'mtm_add_meta');
108
+
109
+
110
+ function mtm_head() {
111
+ //If options form has been submitted, create a $_POST value that will be saved on databse
112
+ $mtm_data = get_option('mtm_data');
113
+ ?>
114
+ <!-- Meta Manager Start -->
115
+ <?php
116
+ foreach( $mtm_data as $meta){
117
+ ?>
118
+ <meta name="<?= $meta[0] ?>" content="<?= $meta[1] ?>" /><?php
119
+ }
120
+ ?>
121
+ <!-- Meta Manager End -->
122
+ <?php
123
+ }
124
+
125
+
126
+
127
+ ?>
mtm_script.js ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Plugin Name: Meta Tag Manager
3
+ Plugin URI: http://blog.netweblogic.com/
4
+ Description: A simple plugin to manage meta tags that appear on all your pages. This can be used for verifiying google, yahoo, and more.
5
+ Author: Marcus Sykes
6
+ Version: 0.1
7
+ Author URI: http://blog.netweblogic.com
8
+ License : GNU General Public License
9
+ Copyright (C) 2008 NetWebLogic LLC
10
+ */
11
+ jQuery(document).ready( function($) {
12
+ jQuery('#mtm_add_tag').click( function(){
13
+ //Get All meta rows
14
+ var metas = jQuery('#mtm_body').children();
15
+ //Copy first row and change values
16
+ var metaCopy = jQuery(metas[0]).clone(true);
17
+ newId = metas.length + 1;
18
+ metaCopy.attr('id', 'mtm_'+newId);
19
+ metaCopy.find('a').attr('rel', newId);
20
+ metaCopy.find('[name=mtm_1_ref]').attr({
21
+ name:'mtm_'+newId+'_ref' ,
22
+ value:''
23
+ });
24
+ metaCopy.find('[name=mtm_1_content]').attr({
25
+ name:'mtm_'+newId+'_content' ,
26
+ value:''
27
+ });
28
+ metaCopy.find('[name=mtm_1_name]').attr({
29
+ name:'mtm_'+newId+'_name' ,
30
+ value:''
31
+ });
32
+ //Insert into end of file
33
+ jQuery('#mtm_body').append(metaCopy);
34
+ //Duplicate the last entry, remove values and rename id
35
+ });
36
+
37
+ jQuery('#mtm_body a').click( function(){
38
+ //Only remove if there's more than 1 meta tag
39
+ if(jQuery('#mtm_body').children().length > 1){
40
+ //Remove the item
41
+ jQuery(jQuery(this).parent().parent().get(0)).remove();
42
+ //Renumber all the items
43
+ jQuery('#mtm_body').children().each( function(i){
44
+ metaCopy = jQuery(this);
45
+ oldId = metaCopy.attr('id').replace('mtm_','');
46
+ newId = i+1;
47
+ metaCopy.attr('id', 'mtm_'+newId);
48
+ metaCopy.find('a').attr('rel', newId);
49
+ metaCopy.find('[name=mtm_'+ oldId +'_ref]').attr('name', 'mtm_'+newId+'_ref');
50
+ metaCopy.find('[name=mtm_'+ oldId +'_content]').attr('name', 'mtm_'+newId+'_content');
51
+ metaCopy.find('[name=mtm_'+ oldId +'_name]').attr( 'name', 'mtm_'+newId+'_name');
52
+ });
53
+ }else{
54
+ metaCopy = jQuery(jQuery(this).parent().parent().get(0));
55
+ metaCopy.find('[name=mtm_1_ref]').attr('value', '');
56
+ metaCopy.find('[name=mtm_1_content]').attr('value', '');
57
+ metaCopy.find('[name=mtm_1_name]').attr( 'value', '');
58
+ alert("If you don't want any meta tags, just leave the text boxes blank and submit");
59
+ }
60
+ });
61
+ });
readme.txt ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Meta Tag Manager ===
2
+
3
+ Contributors: netweblogic
4
+ Tags: Google, SEO, Yahoo, Webmaster Tools, Meta, Meta Tags
5
+ Requires at least: 2.5
6
+ Tested up to: 2.7.1
7
+ Stable tag: 0.2
8
+
9
+ This plugin will allow you to easily add and manage special meta tags to your whole site, such as Yahoo and Google verification tags.
10
+
11
+ == Description ==
12
+
13
+ Simple plugin which allows you to add custom meta tags that will show across all pages on your blog.
14
+
15
+ Just upload, activate, and immediately start adding meta tags.
16
+
17
+ This can be used for adding Google and Yahoo site verification tags along with any other meta tags you may want to add.
18
+
19
+ If you find this plugin useful and would like to donate something, all we ask is you please add a link on your site to the plugin page on our blog, [http://blog.netweblogic.com/php/wordpress-php/meta-tag-manager-wordpress-plugin/](http://blog.netweblogic.com/php/wordpress-php/meta-tag-manager-wordpress-plugin/) thanks!
20
+
21
+
22
+ == Installation ==
23
+
24
+ 1. Upload this plugin to the `/wp-content/plugins/` directory and unzip it, or simply upload the zip file within your wordpress installation from 2.7 onwards.
25
+
26
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
27
+
28
+ 3. Go to Settings > Meta Tag Manager
29
+
30
+ 4. Enter the values in the text boxes. The first text box is so you can give your meta tag a memorable name and is not displayed on the website.
31
+
32
+ 5. Add tags by clicking on the add tag link under the meta rows, and remove tags by clicking on the links next to the meta in question.
33
+
34
+ 6. Save your changes
35
+
36
+
37
+ == Screenshots ==
38
+
39
+ 1. Once activated you can add/edit/delete tags from the menu in Settings > Meta Tag Manager
40
+
41
+
42
+ == Frequently Asked Questions ==
43
+
44
+ None yet!
screenshot-1.jpg ADDED
Binary file