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 | |
/* ===== Change 'MY_PRODUCT_CAT_SLUG' to your product cat slug ===== */ | |
function change_product_cat_links( $link, $post) { | |
$terms = wp_get_post_terms( $post->ID, 'product_cat', $args ); | |
if ( $post->post_type == 'product' && $terms[0]->slug == 'MY_PRODUCT_CAT_SLUG') { | |
$link = trailingslashit( home_url('/MY_PRODUCT_CAT_SLUG/' . $post->post_name ) ); | |
} | |
return $link; |
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 | |
[...] | |
'template' => | |
array( | |
array('core/archives'), | |
array('core/audio'), | |
array('core/block'), | |
array('core/button'), | |
array('core/categories'), |
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 delete_associated_post( $post_id ) { | |
if( get_post_type( $post_id ) === 'books' ){ | |
$medias = get_children( array( | |
'post_parent' => $post_id, | |
'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
function delete_associated_post( $post_id ) { | |
if( get_post_type( $post_id ) === 'books' ){ | |
$medias = get_children( array( | |
'post_parent' => $post_id, | |
'post_type' => 'attachment' | |
) ); | |
if( $medias ){ |
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 | |
/** | |
* Show custom fields in REST API | |
*/ | |
// Callback function | |
function get_post_meta_for_api( $object ) { | |
$more_post_meta['featured_media_url'] = get_the_post_thumbnail_url( $object['id'], 'medium' ); |
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
{ | |
"500px":{}, | |
"accessible-icon":{}, | |
"accusoft":{}, | |
"ad":{}, | |
"address-book":{}, | |
"address-card":{}, | |
"adjust":{}, | |
"adn":{}, | |
"adversal":{}, |
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 custom_admin_product_option($options){ | |
$options = array( | |
'virtual' => array( | |
'id' => '_virtual', | |
'wrapper_class' => 'show_if_simple', | |
'label' => __( 'Virtual', 'woocommerce' ), | |
'description' => __( 'Virtual products are intangible and aren\'t shipped.', 'woocommerce' ), | |
'default' => 'yes', //Alterado |
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 | |
add_filter('wpseo_title', 'filter_wpseo_title'); | |
function filter_wpseo_title($title) { | |
if( is_tax( 'mes-alimento') ) { | |
$title = 'Frutas, verduras e legumes do mês de '.ucfirst(strftime("%B", mktime(0, 0, 0, get_queried_object()->slug) )); // Mostra o nome do mês e não o numero | |
} | |
return $title; | |
} | |
add_filter('wpseo_metadesc', 'filter_wpseo_description'); |
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 | |
/** | |
** convert input array to a csv file and force downlaod the same | |
** | |
** should be called before any output is send to the browser | |
** input array should be an associative array | |
** the key of the associative array will be first row of the csv file | |
** | |
** @link http://perials.com/php-function-convert-array-csv-file-download/ Original post - Php function to convert an array to CSV file for download | |
** @param array $array |
NewerOlder