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
| /*** - Add an "Alt Text" column to the Media Library list view. | |
| –––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
| add_filter( 'manage_media_columns', function( $columns ) { | |
| // Put it after the title column (tweak position as you like) | |
| $new = []; | |
| foreach ( $columns as $key => $label ) { | |
| $new[ $key ] = $label; | |
| if ( 'title' === $key ) { | |
| $new['wsv_alt_text'] = __( 'Alt Text', 'your-textdomain' ); | |
| } |
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
| /*** Rewrite the "Category base" and "Tag base" | |
| –––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
| add_action( 'init', function() { | |
| global $wp_rewrite; | |
| // Set clean category and tag bases | |
| $wp_rewrite->category_base = 'sort-by'; | |
| $wp_rewrite->tag_base = 'sort-by/tag'; |
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
| /*** Remove "automated excerpts" from CPTs | |
| –––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
| /** | |
| * Disable automatic excerpts for specific CPTs. | |
| */ | |
| add_filter( 'get_the_excerpt', function( $excerpt, $post ) { | |
| // List of CPTs that should NOT show excerpts | |
| $blocked_cpts = array( | |
| 'cpt1', |
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
| calc(-1 * var(--padding-sm)) |
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
| /*** Block Editor Notices (Single Page) | |
| –––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
| add_action('enqueue_block_editor_assets', function () { | |
| if ( ! is_admin() ) return; | |
| $screen = function_exists('get_current_screen') ? get_current_screen() : null; | |
| if ( ! $screen || empty($screen->post_type) || $screen->post_type !== 'page' ) return; | |
| $post_id = isset($_GET['post']) ? (int) $_GET['post'] : 0; | |
| $allowed_ids = [8588]; // <-- Insert Post ID(s) |
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
| /** Force-enqueue "Orbital" theme GF assets for ALL forms on all single posts/pages/CPTs **/ | |
| add_action('wp', function () { | |
| if ( is_admin() ) return; // front-end only | |
| if ( ! is_singular() || is_attachment() ) return; // any single post/page/CPT, skip attachments | |
| // Ensure GF is available | |
| if ( ! function_exists('gravity_form_enqueue_scripts') || ! class_exists('GFAPI') ) return; | |
| $uses_ajax = apply_filters('wsv_gf_force_enqueue_ajax', false); // flip to true if you use AJAX sitewide |
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
| /*** Add "Reading Time" to Posts | |
| Display with dyanmic template tag {{fn.wsv_read_time_badge}} - https://snippetclub.com/dynamic-template-tags/ | |
| –––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
| function wsv_calc_read_time($post_id = 0) { | |
| $post_id = $post_id ?: get_the_ID(); | |
| $wpm = (int) apply_filters('wsv_read_time_wpm', 225); | |
| if ($wpm < 100) $wpm = 100; | |
| $content = get_post_field('post_content', $post_id); |
NewerOlder