A mixin for writing @font-face rules in SASS.
Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.
@include font-face(Samplino, fonts/Samplino);
/* ========================== | |
@mixin font-rem | |
============================= | |
Convert px units to rems with fallback to older browsers. | |
Sample: | |
h1 { @include font-rem(16px, 24px) }; | |
Compiles to no CSS: | |
h1 { |
add_action( 'wp_enqueue_scripts', 'enqueue_scripts', 1 ); | |
function enqueue_scripts() { | |
if ( is_front_page() ) { | |
// On the home page, enqueue the home CSS, and don't defer it. | |
// Include the full stylesheet as well, for UX CSS (e.g., :hover), but DO defer it with a filter on style_loader_tag. | |
wp_enqueue_style( 'site-screen-home-no-defer', get_template_directory_uri() . '/css/style.home.css', null, false, 'screen' ); | |
wp_enqueue_style( 'site-screen', get_template_directory_uri() . '/css/style.css', null, false, 'screen' ); | |
} else { | |
wp_enqueue_style( 'site-screen-no-defer', get_template_directory_uri() . '/css/style.css', null, false, 'screen' ); |
A Pen by Barrett Sonntag on CodePen.
<?php | |
class Menu_With_Description extends Walker_Nav_Menu { | |
function start_el(&$output, $item, $depth, $args) { | |
global $wp_query; | |
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; | |
$class_names = $value = ''; | |
$classes = empty( $item->classes ) ? array() : (array) $item->classes; |
If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.
Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.
If in doubt about what git is doing when you run these commands, just
<?php | |
/* | |
* Plugin Name: WP REST API Demo | |
* Plugin URI: https://gist.github.com/wpscholar/693517420ca6c9e29e7719ef24e7e00f | |
* Description: A developer plugin designed for playing around with the WordPress REST API. | |
* Version: 1.0 | |
* Author: Micah Wood | |
* Author URI: https://wpscholar.com | |
* License: GPL2 |