Skip to content

Instantly share code, notes, and snippets.

View BryanBarrera's full-sized avatar

Bryan Barrera BryanBarrera

View GitHub Profile
@BryanBarrera
BryanBarrera / remove-fusion-builder-shortcode.sql
Created March 12, 2024 17:16
Remove fusion builder shortcode(s)
UPDATE wp_posts SET post_content = REGEXP_REPLACE(post_content, "\\[\/?fusion(.*?)\]", "");
@BryanBarrera
BryanBarrera / functions.php
Created December 16, 2020 17:18 — forked from grantambrose/functions.php
Add content to the vertical menu in the Beaver Builder Theme (before)
// Add a Beaver Builder Template to the bottom of the Beaver Builder Theme vertical menu
add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
function your_custom_menu_item ( $items, $args ) {
// if the menu is in fact our header menu
if ($args->theme_location == 'header') {
// get the content of our Beaver Builder Template
$bb_content = do_shortcode('[fl_builder_insert_layout slug="vertical-menu-content-bottom"]');
// append the content of our Beaver Builder Template to the end of our menu
$items = $bb_content . $items;
}
@BryanBarrera
BryanBarrera / functions.php
Created December 16, 2020 17:18 — forked from grantambrose/functions.php
Add content to the vertical menu in the Beaver Builder Theme (before)
// Add a Beaver Builder Template to the bottom of the Beaver Builder Theme vertical menu
add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
function your_custom_menu_item ( $items, $args ) {
// if the menu is in fact our header menu
if ($args->theme_location == 'header') {
// get the content of our Beaver Builder Template
$bb_content = do_shortcode('[fl_builder_insert_layout slug="vertical-menu-content-bottom"]');
// append the content of our Beaver Builder Template to the end of our menu
$items = $bb_content . $items;
}
@BryanBarrera
BryanBarrera / checkFacet.js
Created November 17, 2020 16:25
Check if FacetWP Facet has selection and add a claass
<script>
(function($) {
/**
* check if a facet exists and has value(s), change 'news_categories' to name of the facet being checked
*/
$(document).on('facetwp-loaded', function() {
if (FWP.facets['news_categories'] == 'awards') {
$('.news--container').addClass('is-awards')
} else if (FWP.facets['news_categories'] == 'in-the-news') {
$('.news--container').addClass('is-in-the-news')
@BryanBarrera
BryanBarrera / custom-hooks.php
Created November 12, 2020 02:46 — forked from djrmom/custom-hooks.php
facetwp date source converted to year
<?php
/**
* reindex after adding or updating this filter
*/
add_filter( 'facetwp_index_row', function( $params, $class ) {
if ( 'date_as_year' == $params['facet_name'] ) { // change date_as_year to name of your facet
$raw_value = $params['facet_value'];
$params['facet_value'] = date( 'Y', strtotime( $raw_value ) );
$params['facet_display_value'] = $params['facet_value'];
@BryanBarrera
BryanBarrera / shortcode_post_object.php
Created April 17, 2020 14:02 — forked from phucdohong96/shortcode_post_object.php
Shortcode Sample ACF Post Object & ACF Repeater
<?php
function shortcode_post_object_function() {
ob_start();
$count = 0;
//Get field
$post_objects = get_field ('post_objects');
if (!empty($post_objects)) {
foreach ($post_objects as $post_object) {
$id = $post_object->ID;
@BryanBarrera
BryanBarrera / urlMatchesHref.js
Created April 11, 2020 18:34
If URL matches HREF, add Class
if ( ('.element').length ) {
var url = window.location.pathname;
$('.element a').each(function() {
var href = $(this).attr('href');
if (url.indexOf(href) > -1) {
jQuery(this).parent().addClass('is-active');
}
@BryanBarrera
BryanBarrera / youtube-links.js
Created May 29, 2019 13:47
Automatically make all Youtube links open in fancybox 3 lightbox
@BryanBarrera
BryanBarrera / .sasslintrc
Created May 11, 2019 01:15
.sasslintrc Example File
{
"options": {
"merge-default-rules": false,
"formatter": "html",
"output-file": "linters/sass-lint.html",
"max-warnings": 50
},
"files": {
"include": "src/scss/*/*.s+(a|c)ss",
"ignore": [
@BryanBarrera
BryanBarrera / map-test.html
Created November 1, 2017 13:59 — forked from keccers/map-test.html
Google Maps Custom Zoom Controls
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Custom Controls Test</title>