Skip to content

Instantly share code, notes, and snippets.

Simon Prosser Pross

Block or report user

Report or block Pross

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9ef31db3481f70b7472ac333714ad39f
(function($) {
$(document).ready(function() {
var done = false;
$(window).on('scroll', function() {
if (done) {
return false;
}
if (isScrolledIntoView('.fl-module-post-grid')) {
done = true;
$(window).trigger('resize');
View functions.php
add_shortcode( 'something_unique', function() {
$now = strtotime( 'now' ); // The time now (in seconds).
$fixed_eot_time = strtotime( '31 August 2020' ); // Future time (in seconds).
$days_until_fixed_eot_time = round( ( $fixed_eot_time - $now ) / DAY_IN_SECONDS );
return do_shortcode( sprintf( '[s2Member-Pro-PayPal-Form level="1" ccaps="" desc="RIAPP Member / Professional Annual Membership" ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="riapp.lenadev.com" ta="0" tp="0" tt="D" ra="0.01" rr="BN" rt="D" rp="%s" rrt="" rra="2" accept="paypal,visa,mastercard,amex,discover,maestro,solo" accept_via_paypal="paypal" coupon="" accept_coupons="0" default_country_code="" captcha="0" /]', $days_until_fixed_eot_time ) );
});
View gist:3dd37b8e2038fc8f7bd47014cdc92878
add_filter( 'fl_builder_get_cache_dir', function( $dirinfo ){
if ( 'icons' === basename( $dirinfo['path'] ) ) {
$dirinfo['path'] = trailingslashit( get_stylesheet_directory() ) . 'icons/';
$dirinfo['url'] = trailingslashit( get_stylesheet_directory_uri() ) . 'icons/';
}
return $dirinfo;
});
View functions.php
add_action(
'init',
function() {
if ( isset( $_GET['layout_nuke_js'] ) && is_numeric( $_GET['layout_nuke_js'] ) ) {
$data = get_post_meta( $_GET['layout_nuke_js'], '_fl_builder_data_settings', true );
$draft = get_post_meta( $_GET['layout_nuke_js'], '_fl_builder_draft_settings', true );
$data->js = '';
$draft->js = '';
update_post_meta( $_GET['layout_nuke_js'], '_fl_builder_data_settings', $data );
update_post_meta( $_GET['layout_nuke_js'], '_fl_builder_draft_settings', $draft );
View bb-global-js-reset.php
<?php
/*
Plugin Name: Beaver Builder Global JS Reset
Description: Resets global JS and self deactivates.
Author: <Simon>
Version: 1.0
*/
class BB_Global_JS_Reset {
function __construct() {
include_once ABSPATH . '/wp-admin/includes/plugin.php';
@Pross
Pross / functions.php
Created Dec 19, 2019
10m challenge.. add to mu-plugins to show latest commits and branches in admin bar
View functions.php
<?php
add_action( 'admin_bar_menu', function() {
global $wp_admin_bar;
$menu_id = 'bb-git';
$wp_admin_bar->add_menu( array(
'id' => $menu_id,
'title' => __( 'BB - Git Helper' ),
) );
@Pross
Pross / functions.php
Last active Oct 16, 2019
Current user role shortcode.
View functions.php
<?php // ADDED FOR CODE HIGHLIGHTING
add_shortcode( 'current_role', function() {
global $wp_roles;
$current_user = wp_get_current_user();
$role = array_shift( $current_user->roles );
return isset( $wp_roles->role_names[ $role ] ) ? translate_user_role( $wp_roles->role_names[ $role ] ) : false;
});
View functions.php
<?php // ADDED FOR CODE HIGHLIGHTING
add_shortcode( 'current_role', function() {
global $wp_roles;
$current_user = wp_get_current_user();
$role = array_shift( $current_user->roles );
return isset( $wp_roles->role_names[ $role ] ) ? translate_user_role( $wp_roles->role_names[ $role ] ) : false;
});
View gist:e4f82af63755e455b28ed4c021c933ab
add_action( 'pre_get_posts', function( $query ) {
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
$query->set( 'post_status', array( 'private', 'publish' ) );
}
});
View gist:0956bee3feb78d1f8faf48dffe4d56da
composer config --global repositories.beaver-builder composer https://composer.wpbeaverbuilder.com/KEY
You can’t perform that action at this time.