function get_img_bymodel_callback() { $nonce = $_POST['nonce']; $result = array( 'result' => FALSE ); if ( !wp_verify_nonce( $nonce, 'myajax-post-comment-nonce') ) { die( 'Te atrapamos maldito!' ); } global $post; $the_id_model = $_POST['idmodel']; $taxonomy_modelos = "pa_modelos"; //Extraemos la url imagen del termino $term = get_term( $the_id_model , $taxonomy_modelos ); //colocamos el termino $image = s8_get_taxonomy_image( $term ); //Si el array de ids no se encuentra vaacio if ( !empty( $image ) ) { $result['result'] = TRUE; $result['content'] = $image; } wp_reset_postdata(); echo json_encode( $result ); die(); }
<!-- Creamos una variable global que almacenara el id del select oculto --> <script> var _sl_clousure_type_ = "<?php echo esc_attr( sanitize_title( $name ) ); ?>" </script> <ul id="js-chkbox-type-closeures" data-attribute_name="attribute_<?php echo sanitize_title( $name ); ?>" class="list-inline list-type-closueres hidden-xs"> <?php /* Aquí desplagamos las variaciones del producto */ global $post; $tax_var = "pa_tipo-de-cierre"; //taxonomia tipo de cierre if ( taxonomy_exists( $tax_var ) ) { //si la taxonomia existe $terms = wc_get_product_terms( $post->ID, $tax_var , array( 'fields' => 'all' ) ); foreach ( $terms as $term ) { $image_html = s8_get_taxonomy_image( $term , array(200,210)); $atribute = "attribute_" . sanitize_title( $name ); echo '<li><a href="#" data-attr="'. $term->name .'"><figure>' . $image_html . '</figure><p>'. $term->name . '<span>' . $term->description . '</span></p></a></li>'; } } ?> </ul> <!-- /js-chkbox-type-closeures --> </td> </tr> </tbody> </table> <div class="clearfix"></div>
$term = get_term( $array_id_tax[$i] , $taxonomy ); //conseguir term ID //$t_ID = $term->term_id; //$term_data = get_option("taxonomy_$t_ID"); //echo $t_ID; //var_dump($term_data); $active = $i == 0 ? "active" : ""; ?> <article class="sec__configurations-products__article text-center col-xs-3 <?= $active; ?>"> <?php //Extraemos la url imagen $image = s8_get_taxonomy_image( $term ); //colocamos el termino //Extraemos el título del termino $title = $term->name; //Extraemos la descripcion del termino (medidas) $medidas = $term->description; ?> <figure> <?php echo $image; ?> </figure> <h3 class="sec__configurations-products__article__title"><?php echo $title; ?></h3> <?php if (!empty($medidas)): ?> <p class="semibold">Dimensiones</p>
/** * Adds the thumbnail to all terms in the taxonomy management screens (if they have a thumbnail we can get). * @param $out * @param $column_name * @param $term_id * @return bool|String * @since 0.8.3 */ function edit_taxonomy_columns( $out, $column_name, $term_id ) { if ( $column_name != 's8_tax_image_thumb' ) return $out; $term = get_term( $term_id, $_GET['taxonomy'] ); $image = s8_get_taxonomy_image( $term, array( 50, 50 ) ); if ( $image ) $out = $image; return $out; }
/** * Echo out the html needed to display the taxonomy term image * @param $tax_term Object A WP taxonomy term object * @param string $size (OPTIONAL) A string specifying the image size to get (e.g. thumbnail, medium, full, or a custom size that has been created by you or a plugin). Does NOT work on images that weren't uploaded through the WP media uploader. * @since 0.8.0 */ function s8_taxonomy_image( $tax_term, $size = 'thumbnail' ) { $img = s8_get_taxonomy_image( $tax_term, $size ); if ( $img ) echo $img; }