Skip to content

Instantly share code, notes, and snippets.

View GLWalker's full-sized avatar
🤠

G.L.Walker GLWalker

🤠
  • WeTite
  • Texas
  • 16:54 (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 / 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.
<?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
@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
/**
* Function for recreating BuddyPress pagination with BootStrap 5 markup
*
* @package SystemPress
*/
// Exit if accessed directly.
defined('ABSPATH') || exit;
<?php if (bp_group_has_members(array('per_page' => 10, 'exclude_banned' => 0, 'page_arg' => 'page'))) : ?>
<div class="bp-widget group-members-list table-responsive" aria-live="assertive" aria-relevant="all">
<?php
/**
* Fires before the display of the group members list.
*
* @since 1.1.0
*/