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
alias wp='php wp' | |
alias gs='git status' | |
alias gb='git branch' | |
alias gt='git tag' | |
alias ggo='git checkout' | |
alias gp='git push' | |
alias gpm='git push origin master:master' | |
alias gpd='git push origin develop:develop' | |
alias gpall='gpm && gpd && gp --tags' | |
alias gpupm='git push upstream master' |
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
<style> | |
.wrapliner { | |
background: yellow; | |
display: block; | |
margin-bottom: 5px; | |
} | |
</style> |
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
html { | |
font-size: calc(12px + 9 * ( (100vw - 420px) / 860)); | |
} | |
@media screen and (max-width: 420px) { | |
html { | |
font-size: 12px; | |
} | |
} |
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
/** | |
* WelAjaxForm | |
* | |
* Example: | |
* $('.news-signin').WelAjaxForm({ | |
action: 'form_newsletter_signin', // string | false | |
fields: [ | |
{'name' : {'selector': '#field_name_ft', validation: 'required'}}, | |
{'email' : {'selector': '#field_email_ft', validation: 'required'}} | |
], |
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
/** | |
* Ajax.send(); | |
* | |
* Usage: Ajax.send('my-handler', {"data": "value"}, ajaxurl).then(function(response){ //... }); | |
* | |
* Ajax handler to send messages to WordPress AJAX API | |
*/ | |
(function ($, window, document, undefined) { | |
window.Ajax = (function () { |
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
# fork and clone | |
git clone <repo name> | |
# keep synk with remote origin | |
git remote add origin https://<repo name> | |
# fetch updates from upstream | |
git checkout master | |
git fetch upstream | |
git merge upstream/master |
NewerOlder