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 | |
$page_parent = get_page_by_path( 'page-parent-slug' ); // GET PAGE BY SLUG | |
$page_childs = get_pages( array( | |
'parent' => $page_parent->ID //GET CHILDS | |
) ); | |
print_r( $page_childs ); | |
/* | |
Array | |
( |
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 ( isset( $_POST['g-recaptcha-response'] ) ) { | |
// ENVIA INFORMAÇÕES POR POST PARA TESTAR O CAPTCHA | |
$result = file_get_contents( 'https://www.google.com/recaptcha/api/siteverify', false, stream_context_create( array( | |
'http' => array( | |
'header' => "Content-type: application/x-www-form-urlencoded\r\n", | |
'method' => 'POST', | |
'content' => http_build_query( array( |
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
#!/bin/bash | |
wget --user-agent Mozilla/4.0 'wetransferlink' -O file.zip |
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 | |
$product = wc_get_product( get_the_ID() ); | |
$variations = $product->get_available_variations(); | |
print_r( $variations ); | |
/* | |
Array | |
( | |
[0] => Array | |
( | |
[variation_id] => 109 |
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 $attributes = $product->get_attributes() // GET ALL ATRIBUTES ?> | |
<?php foreach( $attributes as $key => $value ): ?> | |
<?php $attribute_name = preg_replace( '/pa_/', '', $key ) // GET ATTRIBUTE NAME ?> | |
<label> | |
<select name="attribute_pa_<?php echo $attribute_name ?>" id="attribute_pa_<?php echo $attribute_name ?>"> | |
<option value=""><?php echo $attribute_name ?></option> | |
<?php $attribute_name = wc_get_product_terms( get_the_ID(), $key ) // GET ATTRIBUTE NAME ?> | |
<?php $attribute_slug = wc_get_product_terms( get_the_ID(), $key, array( 'fields' => 'slugs' ) ) // GET ATTRIBUTE SLUG ?> | |
<?php for ( $i=0; $i<count( $attribute_name ); $i++ ): // array_slice BECAUSE ARRAY INDEX IS NOT SEQUENCIAL ?> | |
<option value="<?php $slug = array_slice( $attribute_slug, $i, 1 ); echo $slug[0]; ?>"><?php $name = array_slice( $attribute_name, $i, 1 ); echo $name[0]; ?></option> |
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 | |
$featured_products = new WP_Query( array( | |
'post_type' => 'product', | |
'meta_key' => '_featured', | |
'meta_value' => 'yes', | |
'posts_per_page' => -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 | |
$wp_query->get_queried_object(); | |
/* | |
WP_Term Object | |
( | |
[term_id] => 10 | |
[name] => Hoodies | |
[slug] => hoodies | |
[term_group] => 0 | |
[term_taxonomy_id] => 10 |
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 $product = wc_get_product( get_the_ID() ) ?> | |
<form class="txt" method="post" action="<?php the_permalink() ?>?add=<?php get_the_ID() ?>"> | |
<span class="ref">Ref. <?php echo $product->get_sku() ?></span> | |
<div class="price"> | |
<p><?php echo woocommerce_price( $product->get_price_including_tax() ) ?></p> | |
<p> | |
</div> | |
<div class="attributes"> |
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 | |
global $wp_query; | |
echo get_previous_posts_link('<span class="ion-chevron-left"></span>'); | |
echo get_query_var('paged') ? get_query_var('paged') : 1 ?> / <?php echo $wp_query->max_num_pages; | |
echo get_next_posts_link('<span class="ion-chevron-right"></span>'); | |
// Use http://ionicons.com/ |
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 | |
woocommerce_breadcrumb( array('delimiter' => ' >> ') ); |