BibiDeCarli
Forum Replies Created
-
Thank you @givesucesss! But this is exclusive lol
Thanks, I’ll try that ??
Sorry, I’ll post all the code again:
<?php $queried_object = get_queried_object(); $term_id = $queried_object->term_id; global $wp_query; $original_query['tax_query'] = array( array( 'taxonomy' => 't-arte', 'terms' => $term_id, 'field' => 'id', ), ); $original_query = (array) $wp_query; $attach_query = array( 'post_type'=> array( 'attachment' ), 'post_status' => array( null ) ); $args = array_merge($original_query['query_vars'], $attach_query); $media_query = new WP_Query( $args )?> <?php if($media_query->have_posts()) : while ($media_query->have_posts() ) : $media_query->the_post(); if( $post->ID == $do_not_duplicate ) continue; ?> <div id="archivespage-media-item"> <div id="imagem"> <?php echo wp_get_attachment_link($attachment->ID, 'bigger-thumb');?> </div> </div> <?php endwhile; else: ?> //do stuff </div> <?php endif; ?>
If anyone is interested, I’ve made these and now its working nicely. Shows all attachments for a specific term in archive’s page. ??
global $wp_query; // convert query object to array $original_query = (array) $wp_query; // attach query parameters to original query $attach_query = array( 'post_type'=> array( 'attachment' ), 'post_status' => array( null ) ); // merge both arrays $args = array_merge($original_query['query_vars'], $attach_query); query_posts( $args );
I’ve tried change it for this, but now its showing the attachments results by 5 times instead of one O_o
<?php $queried_object = get_queried_object(); $term_id = $queried_object->term_id; $args = array( 'post_status' => 'inherit', 'numberposts' => 0, 'post__not_in' => array_merge($do_not_duplicate,get_option( 'sticky_posts' )), 'post_type' => 'attachment', ); $args['tax_query'] = array( array( 'taxonomy' => 't-arte', 'terms' => $term_id, 'field' => 'id', ), ); ?> <?php $t = $data['t-arte']; $array = explode(" ", $t); $array = array_unique($array);?> <?php $media_query = array_unique($array); ?> <?php $media_query = get_posts($args); if( !empty( $media_query ) ) : foreach ($media_query as $media_query) : global $post; $post = $media_query; setup_postdata($media_query); ?> <div id="archivespage-media-item"> <?php $attachments = get_posts( $args ); if ( $attachments ) { foreach ( $attachments as $attachment ) { echo '<div id="imagem">'; the_attachment_link( $attachment->ID, true ); echo '</div>'; } }?> </div> <?php endforeach;else :?> <p>Ainda n?o temos nenhuma imagem relacionada :(</p> </div> <?php endif; ?> <?php wp_reset_query();?>
I am using my own theme.
Forum: Fixing WordPress
In reply to: Multiple Post Type Multiple Taxonomies inside LoopNo one? ??
Forum: Plugins
In reply to: [Polylang] Count Post in Specif Langue[resolved]
Forum: Plugins
In reply to: [Polylang] Count Post in Specif LangueThank you! ??
Forum: Plugins
In reply to: [Polylang] Count Post in Specif LangueThanks Chouby, but I think I don’t know how to use it…
I’ve tried
<?php global $polylang; $numpost = $polylang->model->count_posts(‘en’); echo $numpost?>
and shows = 0.
Forum: Plugins
In reply to: [Taxonomy Images] Querying for image of termFINALLY! Thanks Manuel!
This is my code to show just a specific category image.
<?php $terms = apply_filters( 'taxonomy-images-get-terms', '', array( 'taxonomy' => 'category', 'term_args' => array( 'slug' => 'webdesign', ) ) ); foreach( (array) $terms as $term) { echo wp_get_attachment_image( $term->image_id, '' ); }?>
Forum: Plugins
In reply to: [Plugin: Taxonomy Images] Get list of all terms/imagesBump!