Modify breadcrumbs homepage link

add_filter( ‘aioseo_breadcrumbs_trail’, ‘homeshop_breadcrumbs_trail’ ); function homeshop_breadcrumbs_trail( $crumbs ) { foreach ( $crumbs as &$crumb ) { if ( ‘homePage’ === $crumb[‘type’] ) { $siteLink = wp_parse_url( $crumb[‘link’] ); $crumb[‘link’] = $siteLink[‘scheme’] . ‘://’ . $siteLink[‘host’] . ‘/shop-displays/’; } } return…Continue reading

parallax

.parallax { background-image: url(“http://example.com/wp-content/uploads/2017/08/my-background-image.jpg”); height: 100%; background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; margin-left:-410px; margin-right:-410px; } .parallax-content { width:50%; margin:0 auto; color:#FFF; padding-top:50px; }Continue reading

Remove Gutenberg Blocks Library CSS

function adms_remove_wp_block_library_css(){ wp_dequeue_style( ‘wp-block-library’ ); wp_dequeue_style( ‘wp-block-library-theme’ ); wp_dequeue_style( ‘wc-blocks-style’ ); // Remove WooCommerce block CSS } add_action( ‘wp_print_styles’, ‘adms_remove_wp_block_library_css’, 100 );Continue reading

Upload font files to media library

add_filter( ‘upload_mimes’, function( $mimes ) { $mimes[‘woff’] = ‘application/x-font-woff’; $mimes[‘woff2’] = ‘application/x-font-woff2’; $mimes[‘ttf’] = ‘application/x-font-ttf’; $mimes[‘svg’] = ‘image/svg+xml’; $mimes[‘eot’] = ‘application/vnd.ms-fontobject’; return $mimes; } );Continue reading

Show local fonts in block editor

add_filter( ‘block_editor_settings_all’, function( $editor_settings ) { $css = wp_get_custom_css_post()->post_content; $editor_settings[‘styles’][] = array( ‘css’ => $css ); return $editor_settings; } );Continue reading

System: API endpoint for plugins

function register_review_list() { register_rest_route(‘review/v1’, ‘reviewList’, [ ‘methods’ => WP_REST_SERVER::READABLE, ‘callback’ => ‘review_list_results’ ]); } function review_list_results($data) { $results = []; // basic error handling if (false === isset($data[‘term’]) ) { return [ ‘error’ => ‘No soup for you…’ ]; }…Continue reading

Post_Created_Sample_Trigger

class Post_Created_Sample_Trigger extends \Uncanny_Automator\Recipe\Trigger { protected function setup_trigger() { // Define the Trigger’s info $this->set_integration( ‘SAMPLE_INTEGRATION’ ); $this->set_trigger_code( ‘POST_CREATED_SAMPLE’ ); $this->set_trigger_meta( ‘POST_TYPE’ ); // Trigger sentence $this->set_sentence( sprintf( esc_attr__( ‘{{A post type:%1$s}} is created sample trigger’, ‘automator-sample’ ), ‘POST_TYPE’ )…Continue reading

Allow SVG Files Upload (copy)

/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading