Title Remover - Version 1.2.1

Version Description

  • Made plugin strings translatable
  • Fixed typos in code
Download this release

Release Info

Developer wpgurus
Plugin Icon 128x128 Title Remover
Version 1.2.1
Comparing to
See all releases

Code changes from version 1.2 to 1.2.1

Files changed (2) hide show
  1. readme.txt +10 -6
  2. title-remover.php +30 -14
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: wpgurus
3
  Tags: title, page title, post title, hide title, remove title, metaboxes, title remover
4
  Donate link: http://wpgurus.net/title-remover/
5
  Requires at least: 2.5
6
- Tested up to: 4.9
7
- Stable tag: 1.2
8
  License: License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -28,12 +28,16 @@ Some advantages of using this plugin:
28
  4. Save changes.
29
 
30
  == Changelog ==
31
- = 1.0 =
32
- * Initial release
 
 
 
 
33
 
34
  = 1.1 =
35
  * Compatibility check with WP 4.9
36
  * Added new graphics for WP.org
37
 
38
- = 1.2 =
39
- * Fixed the warnings that are displayed on some websites.
3
  Tags: title, page title, post title, hide title, remove title, metaboxes, title remover
4
  Donate link: http://wpgurus.net/title-remover/
5
  Requires at least: 2.5
6
+ Tested up to: 5.2.1
7
+ Stable tag: 1.2.1
8
  License: License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
28
  4. Save changes.
29
 
30
  == Changelog ==
31
+ = 1.2.1 =
32
+ * Made plugin strings translatable
33
+ * Fixed typos in code
34
+
35
+ = 1.2 =
36
+ * Fixed the warnings that are displayed on some websites.
37
 
38
  = 1.1 =
39
  * Compatibility check with WP 4.9
40
  * Added new graphics for WP.org
41
 
42
+ = 1.0 =
43
+ * Initial release
title-remover.php CHANGED
@@ -3,17 +3,33 @@
3
  Plugin Name: Title Remover
4
  Plugin URI: http://wpgurus.net/title-remover/
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.2
7
  Author: WPGurus
8
  Author URI: http://wpgurus.net/
9
  License: GPL2
10
  */
11
 
12
- /*--------------------------------------------------
13
- Hide Title
14
- ----------------------------------------------------*/
 
 
 
 
 
 
15
 
16
- function wptr_supress_title( $title, $post_id = 0 ) {
 
 
 
 
 
 
 
 
 
 
17
  if ( ! $post_id ) {
18
  return $title;
19
  }
@@ -26,7 +42,7 @@ function wptr_supress_title( $title, $post_id = 0 ) {
26
  return $title;
27
  }
28
 
29
- add_filter( 'the_title', 'wptr_supress_title', 10, 2 );
30
 
31
  /*--------------------------------------------------
32
  MetaBox
@@ -45,12 +61,12 @@ function wptr_post_meta_boxes_setup() {
45
 
46
  function wptr_add_post_meta_boxes() {
47
  add_meta_box(
48
- 'wptr-hide-title', // Unique ID
49
- 'Hide Title?', // Title
50
- 'wptr_render_metabox', // Callback function
51
- null, // Admin page
52
- 'side', // Context
53
- 'core' // Priority
54
  );
55
  }
56
 
@@ -61,7 +77,7 @@ function wptr_render_metabox( $post ) {
61
  <input type="hidden" name="wptr-hide-title-checkbox" value="0"/>
62
  <input type="checkbox" name="wptr-hide-title-checkbox" id="wptr-hide-title-checkbox"
63
  value="1" <?php checked( $curr_value, '1' ); ?> />
64
- <label for="wptr-hide-title-checkbox">Hide the title for this item</label>
65
  <?php
66
  }
67
 
@@ -83,4 +99,4 @@ function wptr_save_meta( $post_id, $post ) {
83
  /* Get the posted data and sanitize it for use as an HTML class. */
84
  $form_data = ( isset( $_POST['wptr-hide-title-checkbox'] ) ? $_POST['wptr-hide-title-checkbox'] : '0' );
85
  update_post_meta( $post_id, 'wptr_hide_title', $form_data );
86
- }
3
  Plugin Name: Title Remover
4
  Plugin URI: http://wpgurus.net/title-remover/
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.2.1
7
  Author: WPGurus
8
  Author URI: http://wpgurus.net/
9
  License: GPL2
10
  */
11
 
12
+ /**
13
+ * Load plugin text domain
14
+ */
15
+ function wptr_load_plugin_textdomain() {
16
+ load_plugin_textdomain(
17
+ 'title-remover', false,
18
+ dirname( plugin_basename( __FILE__ ) ) . '/languages'
19
+ );
20
+ }
21
 
22
+ add_action( 'plugins_loaded', 'wptr_load_plugin_textdomain' );
23
+
24
+ /**
25
+ * Filter the title and return empty string if necessary.
26
+ *
27
+ * @param $title string The old title
28
+ * @param int $post_id The post ID
29
+ *
30
+ * @return string Old title or empty string.
31
+ */
32
+ function wptr_suppress_title( $title, $post_id = 0 ) {
33
  if ( ! $post_id ) {
34
  return $title;
35
  }
42
  return $title;
43
  }
44
 
45
+ add_filter( 'the_title', 'wptr_suppress_title', 10, 2 );
46
 
47
  /*--------------------------------------------------
48
  MetaBox
61
 
62
  function wptr_add_post_meta_boxes() {
63
  add_meta_box(
64
+ 'wptr-hide-title',
65
+ esc_html__( 'Hide Title?', 'title-remover' ),
66
+ 'wptr_render_metabox',
67
+ null,
68
+ 'side',
69
+ 'core'
70
  );
71
  }
72
 
77
  <input type="hidden" name="wptr-hide-title-checkbox" value="0"/>
78
  <input type="checkbox" name="wptr-hide-title-checkbox" id="wptr-hide-title-checkbox"
79
  value="1" <?php checked( $curr_value, '1' ); ?> />
80
+ <label for="wptr-hide-title-checkbox"><?php esc_html_e( 'Hide the title for this item', 'title-remover' ); ?></label>
81
  <?php
82
  }
83
 
99
  /* Get the posted data and sanitize it for use as an HTML class. */
100
  $form_data = ( isset( $_POST['wptr-hide-title-checkbox'] ) ? $_POST['wptr-hide-title-checkbox'] : '0' );
101
  update_post_meta( $post_id, 'wptr_hide_title', $form_data );
102
+ }