Changeset 3252749
- Timestamp:
- 03/09/2025 05:38:18 AM (13 months ago)
- Location:
- content-shortcode-generator
- Files:
-
- 5 added
- 2 edited
-
tags/1.1 (added)
-
tags/1.1/block.js (added)
-
tags/1.1/content-shortcode-generator.php (added)
-
tags/1.1/index.php (added)
-
tags/1.1/readme.txt (added)
-
trunk/content-shortcode-generator.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
content-shortcode-generator/trunk/content-shortcode-generator.php
r3244521 r3252749 3 3 * Plugin Name: Content Shortcode Generator 4 4 * Description: Create any type of content using Gutenberg editor and insert it anywhere via shortcodes. 5 * Version: 1. 05 * Version: 1.1 6 6 * Author: WPEasyTools 7 7 * Author URI: https://wpeasytools.com/ … … 147 147 148 148 $taxonomy = 'contshge_category'; 149 $selected = ''; 149 150 150 151 // Verify Nonce Security Check 152 $nonce = isset($_GET['my_nonce']) ? sanitize_text_field(wp_unslash($_GET['my_nonce'])) : ''; 153 154 if ($nonce && wp_verify_nonce($nonce, 'my_action')) { 155 $selected = isset($_GET[$taxonomy]) ? sanitize_text_field(wp_unslash($_GET[$taxonomy])) : ''; 156 } else { 157 $selected = ''; // Default if nonce check fails 158 } 159 151 // Securely get the category filter value 152 $selected = filter_input(INPUT_GET, $taxonomy, FILTER_SANITIZE_STRING); 160 153 161 154 $terms = get_terms(array( … … 179 172 } 180 173 add_action('restrict_manage_posts', __NAMESPACE__ . '\\contshge_filter_by_category'); 174 175 /** 176 * Modify the Query to Filter Posts by Selected Category 177 */ 178 function contshge_filter_content_by_category_query($query) { 179 if (is_admin() && $query->is_main_query()) { 180 // Get and sanitize input safely 181 $post_type = filter_input(INPUT_GET, 'post_type', FILTER_SANITIZE_STRING); 182 $category_slug = filter_input(INPUT_GET, 'contshge_category', FILTER_SANITIZE_STRING); 183 184 if ($post_type === 'contshge_content' && !empty($category_slug)) { 185 $query->set('tax_query', array( 186 array( 187 'taxonomy' => 'contshge_category', 188 'field' => 'slug', 189 'terms' => $category_slug, 190 ), 191 )); 192 } 193 } 194 } 195 add_action('pre_get_posts', __NAMESPACE__ . '\\contshge_filter_content_by_category_query'); -
content-shortcode-generator/trunk/readme.txt
r3244521 r3252749 1 1 === Content Shortcode Generator === 2 Contributors: sachinrp232 Contributors: wpeasytools 3 3 Donate link: https://www.wpressblog.com/ 4 4 Tags: shortcode, Gutenberg, content, custom post type, Gutenberg block 5 5 Requires at least: 5.0 6 6 Tested up to: 6.7 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 Requires PHP: 7.2 9 9 License: GPLv2 or later … … 53 53 == Changelog == 54 54 55 = 1.1 = 56 * Category filter solved. 57 55 58 = 1.0 = 56 59 * Initial release with custom post type, category taxonomy, shortcode generation, Gutenberg block support, and admin integration. 57 58 == Upgrade Notice ==59 60 = 1.0 =61 No changes required. Just enable and start creating content with shortcodes.62 60 63 61 == License ==
Note: See TracChangeset
for help on using the changeset viewer.