Title Remover - Version 1.0

Version Description

  • Initial release
Download this release

Release Info

Developer wpis
Plugin Icon 128x128 Title Remover
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (2) hide show
  1. readme.txt +30 -0
  2. title-remover.php +79 -0
readme.txt ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Title Remover ===
2
+ Contributors: wpis
3
+ Tags: title, page title, post title, hide title, remove title, metaboxes, title remover
4
+ Donate link: http://www.brittanyinternetservices.com/
5
+ Requires at least: 2.5
6
+ Tested up to: 3.9.1
7
+ Stable tag: 1.0
8
+ License: License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Gives you the ability to hide the title of any post, page or custom post type item without affecting menus or titles in the admin area.
12
+
13
+ == Description ==
14
+ This plugin adds a simple metabox beside the post creation form in the WordPress admin interface, allowing you to toggle the visibility of the title. Unlike some of the other similar plugins available in the WordPress repository, it completely removes the title instead of just hiding with CSS or JavaScript.
15
+
16
+ Some advantages of using this plugin:
17
+
18
+ **Does not affect menus or the admin area:** Before removing the title it checks to make sure that the front-end is being displayed and the current point is within the loop. In other words it has no effect on menus or post tables in the admin area.
19
+
20
+ **Works with all post types:** To hide the title you just have to use a checkbox on the post creation form. This checkbox is displayed in the form of a metabox for all post types.
21
+
22
+ == Installation ==
23
+ 1. Use Wordpress' plugin interface to find and install the plugin.
24
+ 2. Start editing the post or page whose title you want to hide.
25
+ 3. Among the boxes on the right side you will find one titled 'Hide Title?'. Click on the checkbox.
26
+ 4. Save changes.
27
+
28
+ == Changelog ==
29
+ = 1.0 =
30
+ * Initial release
title-remover.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Title Remover
4
+ Plugin URI: http://www.brittanyinternetservices.com/
5
+ Description: Gives you the ability to hide the title of any post, page or custom post type item without affecting menus or titles in the admin area.
6
+ Version: 1.0
7
+ Author: Brittany Internet Services
8
+ Author URI: http://www.brittanyinternetservices.com/
9
+ License: GPL2
10
+ */
11
+
12
+ /*--------------------------------------------------
13
+ Hide Title
14
+ ----------------------------------------------------*/
15
+
16
+ function wptr_supress_title($title, $post_id) {
17
+ global $id;
18
+ $hide_title = get_post_meta( $post_id, 'wptr_hide_title', true );
19
+ if (!is_admin() && is_singular() && intval($hide_title) && in_the_loop())
20
+ return '';
21
+ return $title;
22
+ }
23
+ add_filter('the_title', 'wptr_supress_title', 10, 2);
24
+
25
+ /*--------------------------------------------------
26
+ MetaBox
27
+ ----------------------------------------------------*/
28
+
29
+ add_action( 'load-post.php', 'wptr_post_meta_boxes_setup' );
30
+ add_action( 'load-post-new.php', 'wptr_post_meta_boxes_setup' );
31
+
32
+ function wptr_post_meta_boxes_setup() {
33
+ /* Add meta boxes on the 'add_meta_boxes' hook. */
34
+ add_action( 'add_meta_boxes', 'wptr_add_post_meta_boxes' );
35
+
36
+ /* Save post meta on the 'save_post' hook. */
37
+ add_action( 'save_post', 'wptr_save_meta', 10, 2 );
38
+ }
39
+
40
+ function wptr_add_post_meta_boxes() {
41
+ add_meta_box(
42
+ 'wptr-hide-title', // Unique ID
43
+ 'Hide Title?', // Title
44
+ 'wptr_render_metabox', // Callback function
45
+ null, // Admin page
46
+ 'side', // Context
47
+ 'core' // Priority
48
+ );
49
+ }
50
+
51
+ function wptr_render_metabox( $object, $box ) {
52
+ $curr_value = get_post_meta( $object->ID, 'wptr_hide_title', true );
53
+ wp_nonce_field( basename( __FILE__ ), 'wptr_meta_nonce' );
54
+ ?>
55
+ <input type="hidden" name="wptr-hide-title-checkbox" value="0" />
56
+ <input type="checkbox" name="wptr-hide-title-checkbox" id="wptr-hide-title-checkbox" value="1" <?php checked($curr_value, '1'); ?> />
57
+ <label for="wptr-hide-title-checkbox">Hide the title for this item</label>
58
+ <?php
59
+ }
60
+
61
+ function wptr_save_meta( $post_id, $post ) {
62
+
63
+ /* Verify the nonce before proceeding. */
64
+ if ( !isset( $_POST['wptr_meta_nonce'] ) || !wp_verify_nonce( $_POST['wptr_meta_nonce'], basename( __FILE__ ) ) )
65
+ return $post_id;
66
+
67
+ /* Get the post type object. */
68
+ $post_type = get_post_type_object( $post->post_type );
69
+
70
+ /* Check if the current user has permission to edit the post. */
71
+ if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
72
+ return $post_id;
73
+
74
+ /* Get the posted data and sanitize it for use as an HTML class. */
75
+ $form_data = ( isset( $_POST['wptr-hide-title-checkbox'] ) ? $_POST['wptr-hide-title-checkbox'] : '0' );
76
+ update_post_meta( $post_id, 'wptr_hide_title', $form_data );
77
+ }
78
+
79
+ ?>