Changeset 3438920
- Timestamp:
- 01/13/2026 06:32:01 PM (3 months ago)
- Location:
- current-post-shortcode
- Files:
-
- 6 edited
- 1 copied
-
tags/3.0.0 (copied) (copied from current-post-shortcode/trunk)
-
tags/3.0.0/current-post-shortcode.php (modified) (1 diff)
-
tags/3.0.0/includes/frontend/shortcode.php (modified) (3 diffs)
-
tags/3.0.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.0.0/current-post-shortcode.php
r3438467 r3438920 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: 2.0.07 * Version: 3.0.0 8 8 * Author: Md Forid Uddin 9 9 * Author URI: https://foriduddin.netlify.app/ -
current-post-shortcode/tags/3.0.0/includes/frontend/shortcode.php
r3438467 r3438920 28 28 29 29 $default = [ 30 'id' => get_the_ID(), 31 'meta' => false, 32 'default' => '', 30 'id' => get_the_ID(), 31 'meta' => false, 33 32 ]; 34 33 … … 44 43 45 44 /* 46 * If value found, return it; otherwise return default value45 * If value found, return it; otherwise return empty string 47 46 */ 48 47 if ( !empty( $meta_value ) ) { … … 50 49 } 51 50 52 return $atts['default'];51 return ''; 53 52 } 54 53 -
current-post-shortcode/tags/3.0.0/readme.txt
r3438467 r3438920 1 1 === Current Post Shortcode === 2 2 Contributors: mdforiduddin 3 Tags: current post shortcode, shortcode, post title, post meta, custom field3 Tags: current post, shortcode, post title, post meta, custom field 4 4 Requires at least: 6.7 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 2.0.07 Stable tag: 3.0.0 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.txt … … 12 12 13 13 == Description == 14 14 15 The "Current Post Shortcode" plugin allows you to display post titles and custom field values using simple shortcodes. You can display the current post's title or meta information, or specify a post ID to retrieve data from a specific post. 16 17 = Display Current Post Title and Meta Information: = 18 - **Post Title:** `[current_post]` → Outputs the current post title, e.g., "Hello World" 19 - **Post Meta** (Custom Field): `[current_post meta="custom_field"]` → Outputs the value of the custom field 20 21 = Display Data from a Specific Post ID: = 22 - **Post Title:** `[current_post id="123"]` → Outputs the title of the post with ID "123" 23 - **Post Meta** (Custom Field): `[current_post id="123" meta="custom_field"]` → Outputs the value of the custom field in the post with ID "123" 24 25 = Display Fallback Meta Value: = 26 - **Post Meta with Fallback:** `[current_post meta="custom_field" default="Default Value"]` → Displays "Default Value" if the custom field is empty 27 28 = Display Default Value for Zero Meta Value: = 29 - **Post Meta with Default for Zero:** `[current_post meta="custom_field" default="Default Value" skip="true"]` → Displays "Default Value" if the custom field value is zero 15 30 16 31 == Installation == 17 32 18 From your WordPress dashboard -> Go to Plugins -> Click on "Add new" -> In the Search field, enter 'Current Post Shortcode' and choose Current Post Shortcode. Press "Install Now" -> After installation, click "Activate". 33 = From your WordPress dashboard: = 19 34 20 Or **install it manually**: 21 1. Download the plugin ZIP file from [WordPress Directory](https://wordpress.org/plugins/current-post-shortcode/). 22 2. Log in to your WordPress Dashboard, navigate to Plugins > Add New and click on "Upload Plugin" button at the top of the page 23 3. Choose the plugin ZIP file you downloaded in step 1 and click "Install Now." 24 4. After the installation is complete, click the "Activate Plugin" button. 35 - Go to Plugins > Add New. 36 - Search for 'Current Post Shortcode'. 37 - Click "Install Now", then "Activate Plugin". 25 38 26 == Shortcodes ==39 = Or **install it manually**: = 27 40 28 1. Display Current Post Title and Meta Information: 29 - Post Title: `[current_post]` 30 - Post Meta (Custom Field): `[current_post meta="custom_field"]` 31 32 2. Display Data from a Specific Post ID: 33 - Post Title: `[current_post id="123"]` 34 - Post Meta: `[current_post id="123" meta="custom_field"]` 41 - Download the plugin ZIP file from [WordPress Directory](https://wordpress.org/plugins/current-post-shortcode/). 42 - Log in to your WordPress Dashboard, navigate to Plugins > Add New, and click the "Upload Plugin" button. 43 - Choose the plugin ZIP file and click "Install Now". 44 - After installation, click "Activate Plugin". 35 45 36 46 == Frequently Asked Questions == 37 47 38 **How do I use the shortcodes?** 48 = How do I use the shortcodes? = 49 39 50 - Use `[current_post]` to display the title of the current post. 40 51 - Use `[current_post meta="custom_field"]` to display a custom field value. 41 - To display data from a specific post, use the `id` attribute : `[current_post id="123"]` for the title or `[current_post id="123" meta="custom_field"]` for a custom field.52 - To display data from a specific post, use the `id` attribute. 42 53 43 **Can I use this shortcode in widgets or other areas of the site?** 44 Yes, you can use these shortcodes anywhere shortcodes are supported in WordPress, such as posts, pages, widgets, and more. 54 = Can I use this shortcode in widgets or other areas of the site? = 55 56 - Yes, you can use these shortcodes anywhere shortcodes are supported in WordPress, such as posts, pages, widgets, Gutenberg blocks, and page builders like Elementor, Divi, WPBakery, etc. 57 58 = How do I handle empty or zero meta values? = 59 60 - You can use the `skip` attribute to skip empty or zero values and optionally display a default value. 61 62 = Is there a fallback for meta values? = 63 64 - Yes, you can use the `default` attribute to provide a fallback value for empty meta values. 45 65 46 66 == Changelog == 47 67 48 = 1.2.2 = 49 * Added post meta fallback message when meta value does not exist. 68 = 3.0.0 - 13/01/2026 = 50 69 51 = 1.0.0 = 70 * Improved shortcode functionality to support additional attributes. 71 * Enhanced compatibility with the latest WordPress versions. 72 * Added fallback meta value for better user experience. 73 74 = 1.0.0 - 11/03/2025 = 75 52 76 * Initial release of the plugin. -
current-post-shortcode/trunk/current-post-shortcode.php
r3438467 r3438920 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: 2.0.07 * Version: 3.0.0 8 8 * Author: Md Forid Uddin 9 9 * Author URI: https://foriduddin.netlify.app/ -
current-post-shortcode/trunk/includes/frontend/shortcode.php
r3438467 r3438920 28 28 29 29 $default = [ 30 'id' => get_the_ID(), 31 'meta' => false, 32 'default' => '', 30 'id' => get_the_ID(), 31 'meta' => false, 33 32 ]; 34 33 … … 44 43 45 44 /* 46 * If value found, return it; otherwise return default value45 * If value found, return it; otherwise return empty string 47 46 */ 48 47 if ( !empty( $meta_value ) ) { … … 50 49 } 51 50 52 return $atts['default'];51 return ''; 53 52 } 54 53 -
current-post-shortcode/trunk/readme.txt
r3438467 r3438920 1 1 === Current Post Shortcode === 2 2 Contributors: mdforiduddin 3 Tags: current post shortcode, shortcode, post title, post meta, custom field3 Tags: current post, shortcode, post title, post meta, custom field 4 4 Requires at least: 6.7 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 2.0.07 Stable tag: 3.0.0 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.txt … … 12 12 13 13 == Description == 14 14 15 The "Current Post Shortcode" plugin allows you to display post titles and custom field values using simple shortcodes. You can display the current post's title or meta information, or specify a post ID to retrieve data from a specific post. 16 17 = Display Current Post Title and Meta Information: = 18 - **Post Title:** `[current_post]` → Outputs the current post title, e.g., "Hello World" 19 - **Post Meta** (Custom Field): `[current_post meta="custom_field"]` → Outputs the value of the custom field 20 21 = Display Data from a Specific Post ID: = 22 - **Post Title:** `[current_post id="123"]` → Outputs the title of the post with ID "123" 23 - **Post Meta** (Custom Field): `[current_post id="123" meta="custom_field"]` → Outputs the value of the custom field in the post with ID "123" 24 25 = Display Fallback Meta Value: = 26 - **Post Meta with Fallback:** `[current_post meta="custom_field" default="Default Value"]` → Displays "Default Value" if the custom field is empty 27 28 = Display Default Value for Zero Meta Value: = 29 - **Post Meta with Default for Zero:** `[current_post meta="custom_field" default="Default Value" skip="true"]` → Displays "Default Value" if the custom field value is zero 15 30 16 31 == Installation == 17 32 18 From your WordPress dashboard -> Go to Plugins -> Click on "Add new" -> In the Search field, enter 'Current Post Shortcode' and choose Current Post Shortcode. Press "Install Now" -> After installation, click "Activate". 33 = From your WordPress dashboard: = 19 34 20 Or **install it manually**: 21 1. Download the plugin ZIP file from [WordPress Directory](https://wordpress.org/plugins/current-post-shortcode/). 22 2. Log in to your WordPress Dashboard, navigate to Plugins > Add New and click on "Upload Plugin" button at the top of the page 23 3. Choose the plugin ZIP file you downloaded in step 1 and click "Install Now." 24 4. After the installation is complete, click the "Activate Plugin" button. 35 - Go to Plugins > Add New. 36 - Search for 'Current Post Shortcode'. 37 - Click "Install Now", then "Activate Plugin". 25 38 26 == Shortcodes ==39 = Or **install it manually**: = 27 40 28 1. Display Current Post Title and Meta Information: 29 - Post Title: `[current_post]` 30 - Post Meta (Custom Field): `[current_post meta="custom_field"]` 31 32 2. Display Data from a Specific Post ID: 33 - Post Title: `[current_post id="123"]` 34 - Post Meta: `[current_post id="123" meta="custom_field"]` 41 - Download the plugin ZIP file from [WordPress Directory](https://wordpress.org/plugins/current-post-shortcode/). 42 - Log in to your WordPress Dashboard, navigate to Plugins > Add New, and click the "Upload Plugin" button. 43 - Choose the plugin ZIP file and click "Install Now". 44 - After installation, click "Activate Plugin". 35 45 36 46 == Frequently Asked Questions == 37 47 38 **How do I use the shortcodes?** 48 = How do I use the shortcodes? = 49 39 50 - Use `[current_post]` to display the title of the current post. 40 51 - Use `[current_post meta="custom_field"]` to display a custom field value. 41 - To display data from a specific post, use the `id` attribute : `[current_post id="123"]` for the title or `[current_post id="123" meta="custom_field"]` for a custom field.52 - To display data from a specific post, use the `id` attribute. 42 53 43 **Can I use this shortcode in widgets or other areas of the site?** 44 Yes, you can use these shortcodes anywhere shortcodes are supported in WordPress, such as posts, pages, widgets, and more. 54 = Can I use this shortcode in widgets or other areas of the site? = 55 56 - Yes, you can use these shortcodes anywhere shortcodes are supported in WordPress, such as posts, pages, widgets, Gutenberg blocks, and page builders like Elementor, Divi, WPBakery, etc. 57 58 = How do I handle empty or zero meta values? = 59 60 - You can use the `skip` attribute to skip empty or zero values and optionally display a default value. 61 62 = Is there a fallback for meta values? = 63 64 - Yes, you can use the `default` attribute to provide a fallback value for empty meta values. 45 65 46 66 == Changelog == 47 67 48 = 1.2.2 = 49 * Added post meta fallback message when meta value does not exist. 68 = 3.0.0 - 13/01/2026 = 50 69 51 = 1.0.0 = 70 * Improved shortcode functionality to support additional attributes. 71 * Enhanced compatibility with the latest WordPress versions. 72 * Added fallback meta value for better user experience. 73 74 = 1.0.0 - 11/03/2025 = 75 52 76 * Initial release of the plugin.
Note: See TracChangeset
for help on using the changeset viewer.