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 | |
| function myprefix_get_attachment_alt( $attachment_ID ) { | |
| // Get ALT | |
| $thumb_alt = get_post_meta( $attachment_ID, '_wp_attachment_image_alt', true ); | |
| // No ALT supplied get attachment info | |
| if ( empty( $thumb_alt ) ) | |
| $attachment = get_post( $attachment_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 | |
| /* | |
| Plugin Name: Just in Time CSS | |
| Plugin URI: https://highrise.digital/ | |
| Description: A plugin from Highrise Digital to provide just in time CSS functionality. | |
| Version: 1.0 | |
| License: GPL-2.0+ | |
| Author: Highrise Digital Ltd | |
| Author URI: https://highrise.digital/ | |
| Text domain: hd-just-in-time-css |
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 | |
| // this snippet extends the acf ability to hide content field with user based condition | |
| // usecase: if a layout of posts_type is built with gutenberg, | |
| // but one wants editor user group to not touch it while being able to inpt data via ACF fields | |
| // use this in conjunction with acf shortcodes in the gutenberg layout | |
| // this way admin can adapt and change layouts with ease making sure edtors do not interact with layouts | |
| function thisbit_remove_post_type_support() { |
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 | |
| // best put in theme that depends on certain plugins | |
| add_filter( 'plugin_action_links', 'disable_plugin_deactivation', 10, 4 ); | |
| function disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) { | |
| if ( array_key_exists( 'deactivate', $actions ) && in_array( $plugin_file, array( | |
| 'advanced-custom-fields/acf.php', | |
| 'gp-premium/gp-premium.php' | |
| ))) | |
| unset( $actions['deactivate'] ); |
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 | |
| // place [content_here] shortcode where you want to place your hooked element | |
| function apuri_hero_hook_function( $atts, $content = null ) { | |
| ob_start(); | |
| do_action( 'prefix_content_here' ); | |
| return ob_get_clean(); | |
| } |
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 | |
| // Set the options page (Depends on ACF Pro) | |
| if( function_exists('acf_add_options_page') ) { | |
| acf_add_options_page(array( | |
| 'page_title' => 'Home Page Hero Settings', | |
| 'menu_title' => 'Home Hero', | |
| 'menu_slug' => 'home-hero-settings', | |
| 'capability' => 'edit_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
| // not sure if this is ok, but it works on my local generatepress site | |
| function prefix_mobile_quicklinks() { | |
| if ( wp_is_mobile() && function_exists( 'generate_after_footer' ) ) : | |
| do_action( 'mobile_quicklinks' ); | |
| endif; | |
| } | |
| add_action( 'generate_after_footer', 'prefix_mobile_quicklinks' ); |
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 | |
| function add_svg_to_upload_mimes( $upload_mimes ) { | |
| $upload_mimes['svg'] = 'image/svg+xml'; | |
| $upload_mimes['svgz'] = 'image/svg+xml'; | |
| return $upload_mimes; | |
| } | |
| add_filter( 'upload_mimes', 'add_svg_to_upload_mimes', 10, 1 ); |
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 or remove capabilities from user roles | |
| * @link https://kinsta.com/blog/wordpress-user-roles/ | |
| *// | |
| function modify_role_caps() { | |
| // Get roles | |
| $author = get_role( 'author' ); | |
| $editor = get_role( 'editor' ); |
OlderNewer