Skip to content

Instantly share code, notes, and snippets.

@alexmustin
alexmustin / functions.php
Created Nov 25, 2020
WordPress - Add page slug to body class
View functions.php
<?php
// Add page slug to Body class.
function add_slug_body_class( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
@alexmustin
alexmustin / load-scripts.php
Created Oct 16, 2020
Course Maker Pro - /lib/load-scripts.php
View load-scripts.php
<?php
/**
* Loads scripts and stylesheets for the Course Maker Pro theme.
*
* @since 1.0
*
* @package Course Maker Pro
*/
add_action( 'wp_enqueue_scripts', 'course_maker_enqueue_scripts_styles' );
@alexmustin
alexmustin / appearance.php
Created Oct 15, 2020
Course Maker Pro - /config/appearance.php
View appearance.php
<?php
/**
* Course Maker Pro appearance settings
*
* @package Course Maker Pro
* @author brandiD
* @license GPL-2.0-or-later
*/
$course_maker_default_colors = array(
@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", {