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
//Remove os campos invalidos do checkout | |
add_action('wp_footer', 'fixInvalidCheckoutFields', 999); | |
function fixInvalidCheckoutFields() { | |
if(is_checkout()){ | |
?> | |
<script> | |
jQuery(window).load(function(){ | |
jQuery('.form-row').removeClass('woocommerce-invalid woocommerce-invalid-required-field woocommerce-validated'); | |
}) | |
</script> |
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 | |
// removes rich text editor for certain pages | |
add_action( 'add_meta_boxes', function(){ | |
if(get_the_ID() === 14) { | |
remove_post_type_support( 'page', 'editor' ); | |
} | |
}); |
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
jQuery(".a-video").colorbox({ | |
rel: 'a-video', | |
iframe: true, | |
innerWidth: 640, | |
innerHeight: 390, | |
href: function () { | |
var videoId = new RegExp('[\\?&]v=([^&#]*)').exec(this.href); | |
if(videoId && videoId[1]){ | |
return 'http://youtube.com/embed/' + videoId[1] + '?rel=0&wmode=transparent'; | |
} |
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 | |
namespace OOPFunctions\Youtube; | |
if ( !class_exists('\OOPFunctions\Youtube\Youtube') ) { | |
/** | |
* Description of Youtube | |
* | |
* @author Pablo Pacheco <[email protected]> |
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 | |
function setThumbnailByUrl( $imgUrl, $post_id ) { | |
$post = get_post($post_id); | |
$media = media_sideload_image($imgUrl, $post_id, $post->post_title); | |
// therefore we must find it so we can set it as featured ID | |
if ( !empty($media) && !is_wp_error($media) ) { | |
$args = array( | |
'post_type' => 'attachment', |
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 | |
namespace OOPFunctions\MetaBoxes\VideoCmb; | |
if ( !class_exists('\OOPFunctions\MetaBoxes\VideoCmb\VideoCmb') ) { | |
/** | |
* Description of VideoCmb | |
* | |
* @author Pablo Pacheco <[email protected]> |
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 | |
$protocol = 'http://'; | |
$http_host = $_SERVER['HTTP_HOST']; | |
$siteFolder = 'cool-magazine'; | |
define('WP_HOME', $protocol.$http_host.'/'.$siteFolder); | |
define('WP_SITEURL', $protocol.$http_host.'/'.$siteFolder); | |
define('WP_CONTENT_URL', $protocol.$http_host.'/'.$siteFolder.'/wp-content'); | |
define('DOMAIN_CURRENT_SITE', $http_host); |
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 | |
//Reduz o estoque quando o pedido eh criado | |
//Tem q ser usado com o plugin (https://wordpress.org/plugins/woocommerce-auto-restore-stock/) | |
//Lembrando que so vai funcionar corretamente com o pagseguro | |
add_action( 'woocommerce_thankyou', 'woocommerce_reduce_order_stock' ); | |
function woocommerce_reduce_order_stock( $order_id ) { | |
global $woocommerce; | |
if ( !$order_id ) | |
return; | |
$order = new WC_Order( $order_id ); |
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 | |
namespace OOPFunctions\MetaBoxes\Gallery; | |
if ( !class_exists('\OOPFunctions\MetaBoxes\Gallery\Gallery') ) { | |
/** | |
* Description of Gallery | |
* | |
* @author Pablo Pacheco <[email protected]> |
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
.center-v-parent{ | |
-webkit-transform-style: preserve-3d; | |
-moz-transform-style: preserve-3d; | |
transform-style: preserve-3d; | |
} | |
.center-v { | |
position: relative; | |
top: 50%; | |
transform: translateY(-50%); | |
} |