Skip to content

Instantly share code, notes, and snippets.

View nomad411's full-sized avatar
🎓
Living la vida mocha!

Gérard Godin nomad411

🎓
Living la vida mocha!
  • GetGo Internet Coaching
View GitHub Profile
add_filter( 'fl_builder_render_css', function( $css, $nodes, $global_settings, $include_global ) {
$site_url = 'https://example.com';
$cdn_url = 'https://123456abcdef.cloudfront.net';
$css = str_replace( $site_url, $cdn_url, $css );
return $css;
}, 10, 4 );
@nomad411
nomad411 / replace_text_with_url_param.js
Created April 11, 2022 14:22 — forked from cgilchrist/replace_text_with_url_param.js
Replace some text on your page with the value of a URL parameter
<script type="text/javascript">
var getUrlParams = function() {
var params = {}, hash;
var hashes = decodeURI(window.location.href).replace(/\+/g," ").slice(window.location.href.indexOf('?') + 1).split('&');
for (var i=0; i<hashes.length; i++) {
hash = hashes[i].split('=');
params[hash[0]] = hash[1];
}
return params;
};
@nomad411
nomad411 / gist:e3837871843636e2f66ab5867d4edb9f
Last active October 16, 2023 15:06
Count Post Views in a WP Custom Field
// Function to increment view count
//
// Use the following shortcode to display it in Beaver Builder:
//
// [wpbb post:custom_field key='my_post_views_count']
//
// Insert the code below in your child theme's functions.php file
function my_post_views() {
if (is_single()) { // Only run on single post pages