This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); |