Skip to content

Instantly share code, notes, and snippets.

View GLWalker's full-sized avatar
🤠

G.L.Walker GLWalker

🤠
  • WeTite
  • Texas
  • 10:53 (UTC -06:00)
View GitHub Profile
@GLWalker
GLWalker / functions.php
Created January 9, 2024 03:15 — forked from jmccall75/functions.php
Locking down Gutenberg...
<?php
/**
* Gutenberg Block customization for this theme.
*/
// gutenberg disable for posts
//add_filter('use_block_editor_for_post', '__return_false', 10);
// gutenberg disable for post types
//add_filter('use_block_editor_for_post_type', '__return_false', 10);
@GLWalker
GLWalker / get-color-values-from-theme-json.php
Created November 8, 2023 06:43 — forked from sethrubenstein/get-color-values-from-theme-json.php
Provides an example of how to extract your color palette from a theme.json file and create styles dynamically.
<?php
function generate_css_from_theme_settings() {
if ( !function_exists('wp_get_global_settings') ) {
return new WP_Error('missing_function', 'wp_get_global_settings() is missing');
}
$colors = wp_get_global_settings();
$colors = $colors['color']['palette']['theme'];
@GLWalker
GLWalker / functions.php
Created May 2, 2023 02:16
Function to convert WordPress Separator Block to a hook
if ( ! function_exists( 'separator_hookr' ) ) {
add_filter( 'render_block_core/separator', 'separator_hookr', null, 2 );
/**
* separator_hookr
*
* Method to add hooks using core/separator block
* seperator block must have a trigger class name of wps-action-hook
* followed by the desired hook name.
@GLWalker
GLWalker / functions.php
Created October 4, 2022 13:29
WordPress Pods Embed & Google Drive Videos BootStrap 5
/**
* Output embedded videos
* wraps embed in Bootstrap Markup
* Pod field is repeatable "oembed" named video_url
* @example embeded_videos($user->ID);
* @param [type] $user as object ID
*/
function embeded_videos($user)
{
@GLWalker
GLWalker / gist:f293e8ab61303c465f41
Created September 16, 2015 15:55
Woocommerce Review Star Ratings. Please read description to learn more...
/* ==========================================================================
Snippet Name: WooCommerce Review Star Ratings
Description: This css snippet blends all woocommerce star rating for a consistant look sitewide. Consolidates code and makes uses of WooCommerce.eot font. If you disabled the woocommerce.css and built your own styles then this will work great. If you are overriding woocommerce.css by adding styles to another styesheet that loads afterwards, this will still work fine, but you may need to target specific elements or create a master reset targeting all elements listed below in order to remove some of woocommerce default margins and padding.
Author: GL Walker
Author URI: http://wsfive.com
========================================================================== */
.woocommerce .star-rating, .woocommerce p.stars [class^="star-"], .woocommerce p.stars [class*=" star-"] {
font-family: WooCommerce;
speak: none;
font-weight: 400;
@GLWalker
GLWalker / customizer-live-preview.js
Created July 19, 2022 00:20
WP Customizer live preview borders
/**
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
* $deselector to exclude elements with var
*/
function osq_classes_live_update( id, classes, selector, deselector, prefix ) {
classes = typeof classes !== 'undefined' ? classes : '';
prefix = typeof prefix !== 'undefined' ? prefix : '';
@GLWalker
GLWalker / customizer-controls.js
Last active March 25, 2022 13:04
Show or hide Wordpress Customizer controls
( function ( api ) {
'use strict';
function osq_hide_controls( id, target, option ) {
target = typeof target !== 'undefined' ? target : '';
option= typeof option !== 'undefined' ? option : '';
api( 'osq_settings[' + id + ']', function ( setting ) {
var linkSettingValueToControlActiveState;
/**
* Update a control's active state according to the setting's value.
@GLWalker
GLWalker / class-wt-walker-page.php
Last active March 7, 2022 17:14
Bootstrap 5 WP Page Walker Widget Classes
<?php
/**
* Post API: Walker_Page class
*
* @package ClassicPress
* @subpackage Template
* @since WP-4.4.0
*
* Modified for Bootstrap 5 List Group with Accordian
<?php
/**
* Putting this here for reference in case others need to accomplish similar. This creates
a new archives widget and adds some settings for bootstrap classes then apply's them
with a couple filters.
*/
/**
* Widget API: WP_Widget_Archives class
*
* @package WordPress
<?php
/**
* Function for recreating BuddyPress pagination with BootStrap 5 markup
*
* @package SystemPress
*/
// Exit if accessed directly.
defined('ABSPATH') || exit;