Skip to content

Instantly share code, notes, and snippets.

<style>
.wrapliner {
background: yellow;
display: block;
margin-bottom: 5px;
}
</style>
@bruno-barros
bruno-barros / bitbucket-pipelines.yml
Created January 6, 2019 00:53 — forked from mcnamee/bitbucket-pipelines.yml
Bitbucket Pipelines - Deploy via FTP to shared hosting
# 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
@bruno-barros
bruno-barros / aliases.sh
Last active December 20, 2023 16:35
aliases.sh
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'
<?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;
}
@bruno-barros
bruno-barros / elementor-video-youtube-enablejsapi.php
Created March 14, 2024 13:37 — forked from EdenK/elementor-video-youtube-enablejsapi.php
Filter to add enablejsapi to Elementor youtube video
<?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);
}