This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add Description & Short Description columns to WooCommerce product list | |
| add_filter( 'manage_product_posts_columns', function( $columns ) { | |
| $columns['short_description'] = __( 'Short Description', 'woocommerce' ); | |
| $columns['full_description'] = __( 'Description', 'woocommerce' ); | |
| return $columns; | |
| }); | |
| add_action( 'manage_product_posts_custom_column', function( $column, $post_id ) { | |
| $product = wc_get_product( $post_id ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add Description & Short Description columns to WooCommerce product list | |
| add_filter( 'manage_product_posts_columns', function( $columns ) { | |
| $columns['short_description'] = __( 'Short Description', 'woocommerce' ); | |
| $columns['full_description'] = __( 'Description', 'woocommerce' ); | |
| return $columns; | |
| }); | |
| add_action( 'manage_product_posts_custom_column', function( $column, $post_id ) { | |
| $product = wc_get_product( $post_id ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Shortcode: [wc_brands_grid_styled] | |
| * Usage: [wc_brands_grid_styled cols="6" cols_tablet="3" cols_mobile="2" hide_empty="true" limit="0" show_count="true"] | |
| * Put this in a snippet plugin (Code Snippets, WPCode, etc.) and activate. | |
| */ | |
| add_shortcode( 'wc_brands_grid_styled', function( $atts ) { | |
| // attributes | |
| $atts = shortcode_atts( array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Show total product + variation count in WooCommerce Products dashboard | |
| add_action( 'manage_posts_extra_tablenav', function( $which ) { | |
| global $wpdb; | |
| if ( $which === 'top' && get_current_screen()->id === 'edit-product' ) { | |
| // Count published products | |
| $products_count = $wpdb->get_var(" | |
| SELECT COUNT(*) | |
| FROM {$wpdb->posts} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add modified date column to posts and pages lists | |
| function custom_modified_date_column($defaults) { | |
| $defaults['modified_date'] = 'Modified Date'; | |
| return $defaults; | |
| } | |
| function custom_modified_date_column_content($column_name, $post_ID) { | |
| if ($column_name == 'modified_date') { | |
| $modified_date = get_post_field('post_modified', $post_ID); | |
| $formatted_date = date_i18n('Y/m/d \a\t g:i a', strtotime($modified_date)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Media SEO Updater β Inline JS + AJAX save (single snippet) | |
| * Paste into Code Snippets or theme/plugin. Runs in admin. | |
| */ | |
| add_action( 'admin_enqueue_scripts', function() { | |
| // Ensure media scripts are available | |
| if ( function_exists( 'wp_enqueue_media' ) ) { | |
| wp_enqueue_media(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Add a custom column for displaying the sale percentage in the WooCommerce Products admin table. | |
| * | |
| * @param array $columns Existing columns in the Products table. | |
| * @return array Modified columns with the Sale Percentage column added. | |
| */ | |
| function add_sale_percentage_column_to_products( $columns ) { | |
| // Add a new column for Sale Percentage | |
| $columns['sale_percentage'] = 'Sale Percentage'; |