Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Mustin alexmustin

View GitHub Profile
@alexmustin
alexmustin / responsive-menus.php
Created Oct 15, 2020
Course Maker Pro - /config/responsive-menus.php
View responsive-menus.php
<?php
/**
* Course Maker - Responsive Menu features
*
* @package Course Maker Pro
* @author StudioPress
* @license GPL-2.0-or-later
* @link https://my.studiopress.com/themes/genesis-sample/
*/
@alexmustin
alexmustin / child-theme-settings.php
Created Oct 15, 2020
Course Maker Pro - /config/child-theme-settings.php
View child-theme-settings.php
<?php
/**
* Course Maker Pro Theme settings.
*
* Genesis 2.9+ updates these settings when themes are activated.
*
* @package Course Maker Pro
*/
return array(
@alexmustin
alexmustin / theme-supports.php
Last active Oct 15, 2020
Course Maker Pro - /config/theme-supports.php
View theme-supports.php
<?php
/**
* Course Maker Pro - Theme supports declarations.
*
* @package Course Maker Pro
* @author StudioPress
* @license GPL-2.0-or-later
* @link https://my.studiopress.com/themes/genesis-sample/
*/
@alexmustin
alexmustin / 01-original-script.js
Last active Oct 12, 2020
JavaScript - Uncaught Error: Syntax error, unrecognized expression: a[href*=#]:not([href=#])
View 01-original-script.js
(function ($) {
$( 'div[class^="front-page-"] a[href*=#]:not([href=#])' ).click( function() {
// More code here...
});
})(jQuery);
@alexmustin
alexmustin / style.css
Last active Aug 12, 2020
CSS - Responsive Body and Header font sizes
View style.css
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: calc(.35vw + 1rem);
line-height: 1.8;
}
h1 {
font-size: calc(2.0vw + 1rem);
}
@alexmustin
alexmustin / block-style-variations.js
Created Aug 5, 2020
WP - Add block style variations
View block-style-variations.js
jQuery(document).ready(function($) {
// Add 'Semibold' style to Paragraph blocks
wp.blocks.registerBlockStyle("core/paragraph", {
name: "semibold",
label: "Semibold"
});
// Add 'Black' style to Paragraph blocks
wp.blocks.registerBlockStyle("core/paragraph", {
@alexmustin
alexmustin / header.php
Last active Aug 3, 2020
Understrap - Off-canvas Mobile Menu
View header.php
<?php
// ...
<!-- // HAMBURGER MENU TOGGLE // -->
<button class="navbar-toggler" type="button" data-toggle="modal" data-target="#menuModal" aria-controls="#menuModal" aria-expanded="false" aria-label="<?php esc_attr_e( 'Toggle navigation', 'understrap' ); ?>">
<i class="fa fa-bars menu_burger" aria-hidden="true"></i>
</button>
<!-- // DESKTOP MENU // -->
<?php wp_nav_menu(
@alexmustin
alexmustin / functions.php
Created Jul 17, 2020 — forked from chrismower/functions.php
WP: Allow shortcodes everywhere
View functions.php
//* Shortcode optimization
add_filter( 'the_content', 'do_shortcode' ); // Allow shortcodes inside of shortcodes
add_filter( 'comment_text', 'do_shortcode' ); // Allow shortcodes in comments
add_filter( 'comment_text', 'shortcode_unautop' ); // Prevent comment shortcodes from wrapping in <p>...</p> tags
add_filter( 'the_excerpt', 'do_shortcode' ); // Allow shortcodes in excerpts
add_filter( 'the_excerpt', 'shortcode_unautop' ); // Prevent excerpt shortcodes from wrapping in <p>...</p> tags
add_filter( 'widget_text', 'do_shortcode' ); // Allow shortcodes in widgets
add_filter( 'widget_text', 'shortcode_unautop' ); // Prevent shortcodes in widgets from wrapping in <p>...</p> tags
@alexmustin
alexmustin / functions.php
Created Apr 2, 2020
Snippet - function to Increase/Decrease brightness of a HEX color by a percentage
View functions.php
<?php
/**
* Increases or decreases the brightness of a color by a percentage of the current brightness.
*
* Credit: https://stackoverflow.com/a/54393956/4256497
*
* @param string $hex_code Supported formats: `#FFF`, `#FFFFFF`, `FFF`, `FFFFFF`
* @param float $adjust_pct A number between -1 and 1. E.g. 0.3 = 30% lighter; -0.4 = 40% darker.
*
@alexmustin
alexmustin / plugin.php
Last active Mar 19, 2020
WordPress - Disable Admin Notification of User Password Change
View plugin.php
<?php
/**
* Disable Admin Notification of User Password Change
*
* Credit: https://wordpress.stackexchange.com/a/266006/67466
*
* Suppressing this email notification has to be handled
* with a plugin because pluggable.php is loaded earlier
* than a theme's functions.php file.