Skip to content

Instantly share code, notes, and snippets.

View aliaghdam's full-sized avatar
💪
Don't be the same, Be Better

Ali Aghdam aliaghdam

💪
Don't be the same, Be Better
View GitHub Profile
@aliaghdam
aliaghdam / style.css
Created October 20, 2017 09:10
Prefix for justify-content css property
-webkit-justify-content: center;
-ms-flex-pack: center; /* IE 10 */
justify-content: center;
@aliaghdam
aliaghdam / command.sh
Created September 21, 2017 13:27
Rename Git Branch - Rename Git Local Branch & Rename Git Remote Branch
# Rename your local branch
git branch -m old-name new-name
# Delete the old branch and push new
git push origin :old-name new-name
# Reset the upstream branch for the new-name local branch
git push origin -u new-name
@aliaghdam
aliaghdam / command.sh
Created September 21, 2017 13:27
Rename Git Branch - Rename Git Local Branch & Rename Git Remote Branch
# Rename your local branch
git branch -m old-name new-name
# Delete the old branch and push new
git push origin :old-name new-name
# Reset the upstream branch for the new-name local branch
git push origin -u new-name
@aliaghdam
aliaghdam / functions.php
Created September 13, 2017 08:50
Show Newspaper (by TagDiv) post videos in Publisher (by BetterStudio)
<?php
add_filter( "get_post_metadata", 'bs_replace_td_video_code', 10, 4 );
function bs_replace_td_video_code( $null, $object_id, $meta_key, $single ) {
if ( $meta_key == '_featured_embed_code' ) {
remove_filter( "get_post_metadata", 'bs_replace_td_video_code', 10 );
@aliaghdam
aliaghdam / functions.php
Last active May 31, 2017 14:47
"Publisher" compatibility with "Featured Image From URL"
<?php
add_filter( 'wp_get_attachment_image_src', 'fifu_replace_attachment_image_src', 10, 2 );
if ( ! function_exists( 'fifu_replace_attachment_image_src' ) ) {
/**
* Replaced attachment src with external thumbnail URL
*
* @hooked wp_get_attachment_image_src
*
@aliaghdam
aliaghdam / functions.php
Created April 18, 2017 11:56 — forked from tripflex/functions.php
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
<?php
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
* to a class, you either have to have access to that class object, or it has to be a call
* to a static method. This method allows you to remove filters with a callback to a class
* you don't have access to.
*
* Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
@aliaghdam
aliaghdam / functions.php
Last active January 21, 2017 12:21
ByPass CloadFlare 404 pages in WordPress - Force WP to show Theme 404 Page in CloadFlare!
add_filter( 'status_header', 'better_studio_bypass_cloadflare_404_status_header', 100, 2 );
function better_studio_bypass_cloadflare_404_status_header( $status_header, $code ) {
// Detect 404 page
if ( $code === 404 ) {
// Return normal content type when user agent in not set
if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
// Return normal content type for real visitors
@aliaghdam
aliaghdam / visual-composer-rtl-fix.js
Last active February 5, 2022 09:34
WordPress Visual Composer full width row ( stretche row ) fix for RTL
jQuery(document).ready(function() {
function bs_fix_vc_full_width_row(){
var $elements = jQuery('[data-vc-full-width="true"]');
jQuery.each($elements, function () {
var $el = jQuery(this);
$el.css('right', $el.css('left')).css('left', '');
});
}