This file contains hidden or 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 | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
global $product; | |
printf( '<a href="%s" class="button">%s</a>', get_permalink( $product->id ), __( 'Ver detalhes' ) ); | |
This file contains hidden or 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 | |
/** | |
* Validate product quantity when added to cart. | |
*/ | |
function cs_add_to_cart_validate_quantity( $valid, $product_id, $quantity ) { | |
global $woocommerce; | |
$valid = true; | |
// Test quantity. |
This file contains hidden or 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 | |
if ( $post->post_parent ) { | |
$args = array( | |
'hierarchical' => 1, | |
'exclude' => $post->ID, | |
'child_of' => $post->post_parent, | |
'post_type' => 'page', | |
'post_status' => 'publish' | |
); | |
} else { |
This file contains hidden or 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 cs_skills( $atts ) { | |
extract( shortcode_atts( array( | |
'name' => '', | |
'perc' => '', | |
), $atts ) ); | |
// Arredonda o valor. de 66 vai para 70. | |
$perc = round( $perc, -1 ); |
This file contains hidden or 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 | |
$sua_query = WP_Query( | |
array( | |
'post_type' => array( 'post', 'page'), | |
'meta_key' => 'destaque_home', | |
'meta_value' => 1, | |
'post_status' => 'publish', | |
'orderby' => 'date', // Não precisava colocar | |
'order' => 'DESC', // Não precisava colocar |
This file contains hidden or 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 | |
/** | |
* Exemplo de WP_Query para custom fields. | |
*/ | |
$custom_query = new WP_Query( array( | |
'meta_key' => 'custom_field', // Nome do custom field. | |
'meta_value' => true, // Valor do custom field. | |
'posts_per_page' => 10, // Quantidade de posts. | |
'post_status' => 'publish', // Pega apenas os posts publicados | |
'ignore_sticky_posts' => 1 // Não adiciona os Sticky Post |
This file contains hidden or 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 | |
/** | |
* Custom Loop Add to Cart. | |
* | |
* Template with quantity. | |
* | |
* @author WooThemes | |
* @package WooCommerce/Templates | |
* @version 1.6.4 | |
*/ |
This file contains hidden or 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 | |
/** | |
* Custom Loop Add to Cart. | |
* | |
* Template with quantity and ajax. | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. | |
global $product; |