Skip to content

Instantly share code, notes, and snippets.

View blakewilson's full-sized avatar
:shipit:

Blake Wilson blakewilson

:shipit:
  • Austin, TX
  • 04:09 (UTC -05:00)
View GitHub Profile
@blakewilson
blakewilson / functions.php
Created March 12, 2024 03:57
Defer Vidbgpro Vimeo player JS
<?php
function defer_vidbgpro_vimeo() {
/**
* As of WP 6.3, you can specify an array of args instead of the boolean for in_footer.
* These args can provide an optional strategy: blocking, defer, or async.
* @link https://make.wordpress.org/core/2023/07/14/registering-scripts-with-async-and-defer-attributes-in-wordpress-6-3/
*/
wp_enqueue_script(
'vidbgpro-vimeo',
@blakewilson
blakewilson / preview.js
Last active May 24, 2023 13:56
Preview in Faust outside of the Template Hierarchy system
import { gql, useQuery } from '@apollo/client';
import { getApolloAuthClient, useAuth } from '@faustwp/core';
import { useRouter } from 'next/router';
function AuthenticatedView(props) {
const {
query: { typeName, p },
} = useRouter();
const client = getApolloAuthClient();
const postType = typeName.toLowerCase();
@blakewilson
blakewilson / [pageNumber].js
Created February 16, 2023 15:38
Faust Next.js file based page for offset pagination
import { gql, useQuery } from '@apollo/client';
import { getNextStaticProps } from '@faustwp/core';
/**
* How many posts you want to display per page
*/
export const POSTS_PER_PAGE = 2;
/**
* Calculates the "offset" by multiplying
@blakewilson
blakewilson / index.html
Created June 12, 2018 01:26
Create a makeshift play event for the Vimeo Player API while autoplay/background embed option is enabled.
<div id="made-in-ny"></div>
<script src="https://player.vimeo.com/api/player.js"></script>
<script>
var options = {
url: 'https://vimeo.com/272406014',
width: 640,
loop: true,
autoplay: true, // Notice autoplay is enabled.
muted: true, // The video has been muted due to new Chrome/Safari autoplay conditions.
@blakewilson
blakewilson / functions.php
Created May 22, 2018 22:00
Include a video background on every page/post
<?php
/**
* Add a video background to every page/post
*
* @version 05222018
* @author Push Labs
* @link https://pushlabs.co
*/
function theme_prefix_vidbg_every_page() {
// Add [vidbg] params as needed. Be sure to change the container to your desired container.
@blakewilson
blakewilson / functions.php
Created May 8, 2018 04:15
Video Background Change "Tap to unmute" text
<?php
/**
* Change Video Background "Tap to unmute" text
*
* @since 2.7.0
* @author Push Labs
* @param String $text The button text
* @return String $text
*/
function themeprefix_vidbg_tap_to_unmute_text( $use_old ) {
@blakewilson
blakewilson / functions.php
Created May 7, 2018 23:57
Video Background Pro use old integrations data model
<?php
/**
* Use Video Background Pro's old integrations data model (not recommended)
*
* @since 3.0.0
* @author Push Labs
* @param Boolean $is_enabled Boolean decisison to enable/disable the integration
* @return Boolean $is_enabled
*/
function themeprefix_vidbgpro_integrations_use_old_data_model( $use_old ) {
@blakewilson
blakewilson / functions.php
Last active May 7, 2018 23:55
Video Background Pro Disable SiteOrigin Page Builder Integration
<?php
/**
* Disable Video Background Pro's SiteOrigin Page Builder Integration
*
* @since 3.0.0
* @author Push Labs
* @param Boolean $is_enabled Boolean decisison to enable/disable the integration
* @return Boolean $is_enabled
*/
function themeprefix_vidbgpro_disable_siteorigin( $is_enabled ) {
@blakewilson
blakewilson / functions.php
Last active March 22, 2018 22:29
Random YouTube Video Backgrounds with Video Background Pro
<?php
/**
* Randomize a list of YouTube videos for a video background through Video Background Pro
*
* @var Array $youtube_url_list an array of YouTube URLs
* @var String $url The random YouTube URL
* @var String $shortcode The [vidbg] shortcode. Make sure to use $url for the $youtube_url
*
* @link https://pushlabs.co/docs/video-background-pro/#using-the-shortcode
*
@blakewilson
blakewilson / methods.js
Created March 3, 2018 04:08
Video Background Pro Methods
// Play the video background
$( '#container' ).data( 'vidbgpro' ).playVidbg();
// Pause the video background
$( '#container' ).data( 'vidbgpro' ).pauseVidbg();
// Mute the video background
$( '#container' ).data( 'vidbgpro' ).muteVidbg();
// UnMute the video background