Proper way to get page content

后端 未结 8 1680
不思量自难忘°
不思量自难忘° 2020-12-22 19:47

I have to get specific page content (like page(12))

I used that :

  post_content;  ?>
         


        
8条回答
  •  囚心锁ツ
    2020-12-22 20:23

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args = array( 'prev_text' >' Previous','post_type' => 'page', 'posts_per_page' => 5, 'paged' => $paged );
    $wp_query = new WP_Query($args);
    while ( have_posts() ) : the_post();
    //get all pages 
    the_ID();
    the_title();
    
    //if you want specific page of content then write
    if(get_the_ID=='11')//make sure to use get_the_ID instead the_ID
    {
    echo get_the_ID();
    the_title();
    the_content();
    }
    
    endwhile;
    

    //if you want specific page of content then write in loop

      if(get_the_ID=='11')//make sure to use get_the_ID instead the_ID
        {
        echo get_the_ID();
        the_title();
        the_content();
        }
    

提交回复
热议问题