Skip to content

Instantly share code, notes, and snippets.

@bob-moore
bob-moore / wde-programmable-search.html
Last active August 26, 2025 16:45
WDE Search and Ready Classes
<script async src="https://cse.google.com/cse.js?cx=7653a89649b0b43df">
</script>
<div class="gcse-search"></div>
@bob-moore
bob-moore / login-custom-plugin.php
Created March 21, 2022 16:59
Quick plugin to disable astra transparent header on login page
<?php
/**
* @wordpress-plugin
* Plugin Name: CUSTOM PLUGIN NAME
* Plugin URI: https://YOURDOMAIN.com
* Description: CUSTOM PLUGIN DESCRIPTION
* Version: 1.0.0
* Author: YOUR NAME
* Author URI: https://YOURDOMAIN.com
* License: GPL-2.0+
<?php
function generate_price_metadata( $product_id ) {
/**
* Get the product based on ID
*/
$product = wc_get_product( $product_id );
/**
* This should be set during import to false
*
<?php
function prefix_print_error( $item, $action = 'shutdown' ) {
add_action( $action, function() use( $item ) {
printf( '<script>console.log(%s);</script>', json_encode( $item, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_PRETTY_PRINT ) );
}, 9999 );
}
@bob-moore
bob-moore / elementor-mods.php
Last active April 4, 2023 12:45
Removing core theme builder locations in Elementor. The first file is the original file in Elementor, just for reference. The second is a mu plugin to disable select locations. This must be ran via plugin or mu-plugin, because it runs before themes are loaded.
<?php
/**
* Plugin Name: Elementor Mods
* Plugin URI: https://gist.github.com/bob-moore/986bafade1aa0b04bb30e0a2f08fb105
* Description: Mod some elementor stuff
* Version: 0.1.0
* Author: Bob Moore
* Author URI: https://github.com/bob-moore
* License: GPL-2.0+
<?php
function reorder_admin_menu( $menu_items ) {
// Our top level items
$top_level = array();
// Post Types
$post_types = array();
// Our bottom level items
$bottom_level = array();
// And our penalty box...known that we want last
@bob-moore
bob-moore / site-specific-plugin-sample.php
Created January 22, 2018 00:23
Site Specific Plugin Sample
<?php
/**
* Plugin Name: Site Specific Plugin File
* Plugin URI: https://www.wpcodelabs.com
* Description: Site Specific Plugin for [project_name]
* Version: 1.0.0
* Author: WP Code Labs
* Author URI: http://www.wpcodelabs.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@bob-moore
bob-moore / functions.php
Last active September 12, 2017 17:51
Quick ACF page section stuff
<?php
function display_acf_page_sections() {
// Construct ID
$id = !empty( get_sub_field('section_id') ) ? sprintf( ' id="%s"', esc_attr( get_sub_field('section_id') ) ) : '';
// Construct class
$class = !empty( get_sub_field('section_class') ) ? sprintf( ' class="my_custom_class %s"', esc_attr( get_sub_field('section_class') ) ) : ' class="my_custom_class';
// Construct style
$bg_image = get_sub_field('section_background_image');
$bg_color = get_sub_field('section_background_image');
if( empty( $bg_image ) && empty( $bg_color ) ) {
@bob-moore
bob-moore / jp_tweak.php
Created April 27, 2017 16:09
Functions to tweak share button placement of jetpack
<?php
/**
* Function to remove automatic placement of sharing buttons from jetpack
*/
if( !function_exists( 'jptweak_remove_share' ) ) {
function jptweak_remove_share() {
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
if ( class_exists( 'Jetpack_Likes' ) ) {
@bob-moore
bob-moore / wp-config-debug.php
Last active June 12, 2024 13:56
Wordpress Debugging Settings
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
define( 'WP_DEBUG_LOG', true );
define( 'SCRIPT_DEBUG', true );
define( 'JETPACK_DEV_DEBUG', true );