Changeset 3438931
- Timestamp:
- 01/13/2026 06:50:39 PM (3 months ago)
- Location:
- current-post-shortcode
- Files:
-
- 6 edited
- 1 copied
-
tags/3.1.0 (copied) (copied from current-post-shortcode/trunk)
-
tags/3.1.0/current-post-shortcode.php (modified) (1 diff)
-
tags/3.1.0/includes/frontend/shortcode.php (modified) (3 diffs)
-
tags/3.1.0/readme.txt (modified) (2 diffs)
-
trunk/current-post-shortcode.php (modified) (1 diff)
-
trunk/includes/frontend/shortcode.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
current-post-shortcode/tags/3.1.0/current-post-shortcode.php
r3438920 r3438931 5 5 * Plugin URI: https://github.com/mdforiduddin/ 6 6 * Description: The Current Post Shortcode plugin allows you to display the current post's title and metadata using simple shortcodes. 7 * Version: 3. 0.07 * Version: 3.1.0 8 8 * Author: Md Forid Uddin 9 9 * Author URI: https://foriduddin.netlify.app/ -
current-post-shortcode/tags/3.1.0/includes/frontend/shortcode.php
r3438920 r3438931 20 20 21 21 /** 22 * Get value with skip logic 23 * 24 * @param mixed $meta_value 25 * @param mixed $default 26 * @return mixed 27 */ 28 private function get_value_with_skip( $meta_value, $default ) { 29 if ( empty( $meta_value ) ) { 30 return $default; 31 } 32 return $meta_value; 33 } 34 35 /** 36 * Get value without skip logic 37 * 38 * @param mixed $meta_value 39 * @param mixed $default 40 * @return mixed 41 */ 42 private function get_value_without_skip( $meta_value, $default ) { 43 if ( isset( $meta_value ) && $meta_value !== '' ) { 44 return $meta_value; 45 } 46 return $default; 47 } 48 49 /** 22 50 * Render the shortcode 23 51 * … … 28 56 29 57 $default = [ 30 'id' => get_the_ID(), 31 'meta' => false, 58 'id' => get_the_ID(), 59 'meta' => false, 60 'default' => '', 61 'skip' => false, 32 62 ]; 33 63 … … 43 73 44 74 /* 45 * If value found, return it; otherwise return empty string75 * If skip is set, use skip logic; otherwise, use normal logic 46 76 */ 47 if ( !empty( $ meta_value) ) {48 return $ meta_value;77 if ( !empty( $atts['skip'] ) ) { 78 return $this->get_value_with_skip( $meta_value, $atts['default'] ); 49 79 } 50 80 51 return '';81 return $this->get_value_without_skip( $meta_value, $atts['default'] ); 52 82 } 53 83 -
current-post-shortcode/tags/3.1.0/readme.txt
r3438920 r3438931 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 3. 0.07 Stable tag: 3.1.0 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.txt … … 66 66 == Changelog == 67 67 68 = 3.1.0 - 14/01/2026 = 69 70 * Added Shortcode functionality for displaying current post information. 71 * Added support for displaying meta values with fallback options. 72 68 73 = 3.0.0 - 13/01/2026 = 69 74 -
current-post-shortcode/trunk/current-post-shortcode.php
r3438920 r3438931 5 5 * Plugin URI: https://github.com/mdforiduddin/ 6 6 * Description: The Current Post Shortcode plugin allows you to display the current post's title and metadata using simple shortcodes. 7 * Version: 3. 0.07 * Version: 3.1.0 8 8 * Author: Md Forid Uddin 9 9 * Author URI: https://foriduddin.netlify.app/ -
current-post-shortcode/trunk/includes/frontend/shortcode.php
r3438920 r3438931 20 20 21 21 /** 22 * Get value with skip logic 23 * 24 * @param mixed $meta_value 25 * @param mixed $default 26 * @return mixed 27 */ 28 private function get_value_with_skip( $meta_value, $default ) { 29 if ( empty( $meta_value ) ) { 30 return $default; 31 } 32 return $meta_value; 33 } 34 35 /** 36 * Get value without skip logic 37 * 38 * @param mixed $meta_value 39 * @param mixed $default 40 * @return mixed 41 */ 42 private function get_value_without_skip( $meta_value, $default ) { 43 if ( isset( $meta_value ) && $meta_value !== '' ) { 44 return $meta_value; 45 } 46 return $default; 47 } 48 49 /** 22 50 * Render the shortcode 23 51 * … … 28 56 29 57 $default = [ 30 'id' => get_the_ID(), 31 'meta' => false, 58 'id' => get_the_ID(), 59 'meta' => false, 60 'default' => '', 61 'skip' => false, 32 62 ]; 33 63 … … 43 73 44 74 /* 45 * If value found, return it; otherwise return empty string75 * If skip is set, use skip logic; otherwise, use normal logic 46 76 */ 47 if ( !empty( $ meta_value) ) {48 return $ meta_value;77 if ( !empty( $atts['skip'] ) ) { 78 return $this->get_value_with_skip( $meta_value, $atts['default'] ); 49 79 } 50 80 51 return '';81 return $this->get_value_without_skip( $meta_value, $atts['default'] ); 52 82 } 53 83 -
current-post-shortcode/trunk/readme.txt
r3438920 r3438931 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 3. 0.07 Stable tag: 3.1.0 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.txt … … 66 66 == Changelog == 67 67 68 = 3.1.0 - 14/01/2026 = 69 70 * Added Shortcode functionality for displaying current post information. 71 * Added support for displaying meta values with fallback options. 72 68 73 = 3.0.0 - 13/01/2026 = 69 74
Note: See TracChangeset
for help on using the changeset viewer.