Poste de requête wp par id

Exemples de code

1
0

wordpress obtenir un message par id

$post   = get_post( 123 ); // Where 123 is the ID
$output =  apply_filters( 'the_content', $post->post_content );
0
0

requête fiscale wp

//simple
'tax_query' => array(
    array(
        'taxonomy' => 'people',
        'field'    => 'slug',
        'terms'    => 'bob',
    ),
),

//more complicated
'tax_query' => array(
    'relation' => 'OR',
    array(
        'taxonomy' => 'category',
        'field'    => 'slug',
        'terms'    => array( 'quotes' ),
    ),
    array(
        'relation' => 'AND',
        array(
            'taxonomy' => 'post_format',
            'field'    => 'slug',
            'terms'    => array( 'post-format-quote' ),
        ),
        array(
            'taxonomy' => 'category',
            'field'    => 'slug',
            'terms'    => array( 'wisdom' ),
        ),
    ),
),
0
0

wordpress interroge un message par identifiant

//WordPress: Query a specific post by its post type & ID
//For example, query Case Study with ID #12345

<?php query_posts('post_type=case_studies&p=12345'); ?>
  
/*To determine a post ID, refer to the
URL of the post while editing it:
http://localhost...wp-admin/post.php?post=12345...*/
0
0

wp_query obtenir un type de message personnalisé

  <?php    
  	   $args = array(  
      'post_type' => 'custom_type',
      'post_status' => 'publish',
      'posts_per_page' => 8, 
      'orderby' => 'title', 
      'order' => 'ASC', 
          );

  $loop = new WP_Query( $args ); 

  while ( $loop->have_posts() ) : $loop->the_post(); 
      print the_title(); 
      the_excerpt(); 
  endwhile;

  wp_reset_postdata(); 
  ?>

Pages connexes

Pages d'exemples similaires

Dans d'autres langues

Cette page est dans d'autres langues

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................