redkxbr
Respostas criadas no fórum
A visualizar 4 respostas - de 1 a 4 (de um total de 4)
-
Fórum: Temas e templates
Em resposta a: Exibir posts apenas de determinado formatodepois de quebrar bastante a cabeça consegui o código:
<?php $args = array( 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-status', 'post-format-aside', 'post-format-gallery', 'post-format-quote', 'post-format-audio'), ) ) ); ?> <?php query_posts( '&orderby=title&order=asc&posts_per_page=-1&cat=' . $cat . '&args=' . $args );?> <ol> <?php while ( have_posts() ) : the_post(); ?> <li><a href="<?php the_permalink() ?>"> <?php the_title(); ?> </a></li> <?php endwhile; ?> </ol> <?php wp_reset_query(); ?>
Mas não estou conseguindo aplicar esses argumentos:
<?php query_posts( '&orderby=title&order=asc&posts_per_page=-1&cat=' . $cat . '&args=' . $args );?>
qual a forma correta de aplicar?
Fórum: Temas e templates
Em resposta a: Exibir posts apenas de determinado formatoConsegui desenvolver com base no site que me enviou esse codigo, só que nao consigo que ele apareça todas os posts (posts_per_page=-1) o que devo fazer?
<?php // The Args $args = array( 'cat' => $cat, 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-quote','post-format-audio','post-format-gallery','post-format-image','post-format-link','post-format-video') ) ) ); // The Query query_posts( $args ); // The Loop while ( have_posts() ) : the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; // Reset Query wp_reset_query(); ?>
Fórum: Temas e templates
Em resposta a: Exibir posts apenas de determinado formatoAmigo preciso da sua ajuda o meu codigo apresentou falhas.
Consegui desenvolver esse:
<?php $args = array( 'cat' => $cat, 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-status','post-format-gallery','post-format-aside','post-format-quote','post-format-audio'), ) ) ); ?> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> <?php endif; ?>
Mas não consigo que ele mostre apenas os post-formats que informei no campo terms e tambem gostaria que ele tivesse posts_per_page=-1 para listar todas as publicações
Fórum: Temas e templates
Em resposta a: Exibir posts apenas de determinado formatoObrigado amigo.
Consegui um código que funcione também.
<?php /* POSTS NOTA */ ?> <?php $category_id = get_cat_ID(single_cat_title('', false)); $args = array( 'cat' => $category_id, 'post_type' => 'post', 'post_status' => 'publish', 'order' => 'DESC', 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-aside' ), 'operator' => 'IN', ) ) ); $status_updates = get_posts( $args ); if ( $status_updates ) : ?> <?php foreach ( $status_updates as $post ) : setup_postdata( $post ); ?> <li><a href="<?php the_permalink(); ?>" title="<?php esc_attr( the_title() ); ?>"><?php the_title(); ?></a></li> <?php endforeach; endif; ?>
Me ajudou mesmo assim! Valeu!
A visualizar 4 respostas - de 1 a 4 (de um total de 4)