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
<?php | |
/** | |
* Filter to add enablejsapi to Elementor youtube video | |
*/ | |
function add_youtube_jsapi($iframe_html, $video_url, $frame_attributes) { | |
if(strpos($video_url, 'youtube') !== false) { | |
$src = esc_attr($frame_attributes['src']); | |
$new_src = esc_attr(add_query_arg(array('enablejsapi' => '1'), $frame_attributes['src'])); | |
$iframe_html = str_replace($src, $new_src, $iframe_html); | |
} |
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
<?php | |
//Insert ads after second paragraph of single post content. | |
add_filter( 'the_content', 'prefix_insert_post_ads' ); | |
function prefix_insert_post_ads( $content ) { | |
$ad_code = '<div>Ads code goes here</div>'; | |
if ( is_single() && ! is_admin() ) { | |
return prefix_insert_after_paragraph( $ad_code, 2, $content ); | |
} | |
return $content; | |
} |
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
# Installation --- | |
# 1. In Bitbucket, add $FTP_USERNAME $FTP_PASSWORD and $FTP_HOST as environment variables. | |
# 2. Commit this file to your repo | |
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will | |
# push everything and initial GitFTP) | |
# | |
# Usage --- | |
# - On each commit to master branch, it'll push all files to the $FTP_HOST | |
# - You also have the option to 'init' (from Bitbucket Cloud) - pushes everything and initialises | |
# - Finally you can also 'deploy-all' (from Bitbucket Cloud) - if multiple deploys fail, you |
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
<?php | |
$location = get_field('location'); | |
if( !empty($location) ): | |
?> | |
<a href="http://www.google.com/maps/preview#!q=<?=urlencode( $location['address'] )?>"> | |
<img src="http://maps.googleapis.com/maps/api/staticmap?center=<?php echo $location['lat']; ?>,<?php echo $location['lng']; ?>&zoom=15&format=png&sensor=false&size=397x297&maptype=roadmap&visual_refresh=true&style=visibility:off&style=feature:road|element:geometry|visibility:simplified&style=feature:landscape|element:geometry|visibility:simplified&style=element:labels|visibility:on&markers=color:red|<?php echo $location['lat']; ?>,<?php echo $location['lng']; ?>"/> | |
</a> | |
<?php endif; ?> |
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
angular.module('myMdl', []).config(['$httpProvider', function($httpProvider) { | |
$httpProvider.responseInterceptors.push([ | |
'$q', '$templateCache', 'activeProfile', | |
function($q, $templateCache, activeProfile) { | |
// Keep track which HTML templates have already been modified. | |
var modifiedTemplates = {}; | |
// Tests if there are any keep/omit attributes. | |
var HAS_FLAGS_EXP = /data-(keep|omit)/; |