This file contains 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 | |
//* Force full-width-content layout for Gutenberg pages | |
add_filter( 'genesis_site_layout', 'setGutenbergPageLayout' ); | |
function setGutenbergPageLayout(){ | |
if ( function_exists( 'has_blocks' ) && has_blocks( get_the_ID() ) ) { | |
return 'full-width-content'; | |
} | |
} |
This file contains 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_action( "customize_register", "am_customizer_mods" ); | |
function am_customizer_mods( $wp_customize ) { | |
//* Remove 'header image' Control | |
$wp_customize->remove_control("header_image"); | |
//* Remove 'widgets' Panel | |
$wp_customize->remove_panel("widgets"); |
This file contains 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 featured image on single post | |
add_action( 'genesis_entry_header', 'hellopro_featured_image', 1 ); | |
function hellopro_featured_image() { | |
$image = genesis_get_image( array( | |
'format' => 'html', | |
'size' => 'featured', | |
'context' => '', | |
'attr' => array ( 'class' => 'aligncenter' ), |
This file contains 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 code adds a custom Shortcode to display a "Featured Post." | |
*/ | |
function featuredpost_shortcode( $atts ) { | |
// Var defaults | |
$defaults['id'] = 1; | |
$postID = ''; |
This file contains 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
[data-type="atomic-blocks/ab-container"] > .editor-block-list__block-edit { | |
border: 2px dotted #ccc; | |
} |
This file contains 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 | |
//* Enqueue Script | |
add_action( 'wp_enqueue_scripts', 'yourtheme_enqueue_globaljs_script' ); | |
function yourtheme_enqueue_globaljs_script() { | |
wp_enqueue_script( 'global-js', get_stylesheet_directory_uri() . "/global.js", array( 'jquery' ), '1.0', true ); | |
} |
This file contains 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 | |
// Use Dark Mode in Block Editor. | |
add_theme_support( 'dark-editor-style' ); | |
?> |
This file contains 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 | |
/** | |
* 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. |
This file contains 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 | |
/** | |
* 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. | |
* |
This file contains 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
//* 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 |