Code for importing theme files from plugin

/** * Import an entire folder from a plugin into the WordPress theme. * * @param string $plugin_folder Plugin folder path. * @param string $theme_folder Theme folder path. * * @return bool True on success, false on failure. */ function…Continue reading

Add Theme Supports

add_editor_style( ‘style-editor.css’ ); add_theme_support( ‘appearance-tools’ ); add_theme_support( ‘align-wide’ ); add_theme_support( ‘responsive-embeds’ ); add_theme_support( ‘post-formats’, array( ‘aside’, ‘gallery’, ‘link’, ‘image’, ‘quote’, ‘status’, ‘video’, ‘audio’, ‘chat’ ) // WordPress supports the following post formats. These formats cannot be changed by the average…Continue reading

WPCode Functions

// Skip show library screen add_filter( ‘wpcode_add_snippet_show_library’, ‘__return_false’ ); // Move status column add_filter( ‘wpcode_code_snippets_table_columns’, function ( $columns ) { if ( isset( $columns[‘status’] ) ) { $status = $columns[‘status’]; unset( $columns[‘status’] ); $columns = array_slice( $columns, 0, 1, true…Continue reading

product attributes on hover

// PHP function to display product attributes add_action( ‘woocommerce_after_shop_loop_item_title’, ‘display_product_attributes_on_hover’, 10 ); function display_product_attributes_on_hover() { global $product; // Get product attributes $attributes = $product->get_attributes(); if ( ! empty( $attributes ) ) { // Output container for product attributes, initially hidden…Continue reading