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 functions.php
add_filter( 'fl_module_upload_regex', function( $regex, $type, $ext, $file ) {
$regex['photo'] = '#(jpe?g|png|gif|bmp|tiff?|svg)#i';
return $regex;
}, 10, 4 );
@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 composer.json
{
"repositories": {
"beaver-builder": {
"type": "composer",
"url": "https://composer.wpbeaverbuilder.com/KEY"
}
},
"require": {
"beaver-builder/bb-plugin-pro": "*",
"beaver-builder/bb-theme": "*",
@Pross
Pross / js.js
Created Jan 21, 2019
How to paste random jQuery from the internet.
View js.js
(function($){
$(document).ready(function(){
// This runs on ready function
// Add Copy+Pasta here
});
})(jQuery);
View gist:0956bee3feb78d1f8faf48dffe4d56da
composer config --global repositories.beaver-builder composer https://composer.wpbeaverbuilder.com/KEY
@Pross
Pross / fl-builder-layout.js
Created Sep 4, 2019
bb-plugin/js/fl-builder-layout.js
View fl-builder-layout.js
(function($){
if(typeof FLBuilderLayout != 'undefined') {
return;
}
/**
* Helper class with generic logic for a builder layout.
*
* @class FLBuilderLayout
@Pross
Pross / sendy.php
Created Apr 26, 2016
Add to mu-plugins folder, auto add every new user to a sendy list. Works with default WordPress and Woocommerce registrations.
View sendy.php
<?php
add_action( 'user_register', 'add_user_to_sendy_list' );
function add_user_to_sendy_list( $user_id ) {
$list = 'SENDY_LIST_ID';
$url = 'http://SENDY_INSTALL_URL/subscribe';
$user = get_userdata( $user_id );
$email = $user->data->user_email;
$name = $user->data->user_nicename;
@Pross
Pross / css.css
Created Jun 24, 2019
Disable row shapes in ie11
View css.css
body.fl-builder-ie-11 div.fl-builder-shape-layer {
display:none;
}
You can’t perform that action at this time.