WordPress调用PAGE页面到内容以及图片

WordPress调用PAGE页面到内容以及图片:

                        $args = array(
                            'include' => '540',//调用指定id,可以多id
                            'post_type' => 'page',
                            'post_status' => 'publish'
                        );
                        $pages = get_pages($args);
                        foreach ( $pages as $post ) : setup_postdata( $post ); ?>
                       <div class="col-6">
                       <?php if ( has_post_thumbnail() ) { the_post_thumbnail();} else {}?>
                       </div>
                       <div class="text_mache col-6">
                       <?php 
					   $the_content = apply_filters('the_content', get_the_content());
                       if ( !empty($the_content) ) {echo $the_content;}
					   ?>
                       <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                       </div>
                        <?php endforeach;
                        wp_reset_postdata();

另外一段:

                        $args = array(
                            'include' => '8',//调用指定id,可以多id
                            'post_type' => 'page',
                            'post_status' => 'publish'
                        );
                        $pages = get_pages($args);
                        foreach ( $pages as $post ) : setup_postdata( $post ); ?>
                        
                             <div class="text_mache col-6">
                       <?php 
					   $the_content = apply_filters('the_content', get_the_content());
                       if ( !empty($the_content) ) {echo $the_content;}
					   ?>
                       <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                       </div>
                        
                       <div class="col-6">
                       <?php if ( has_post_thumbnail() ) { the_post_thumbnail();} else {}?>
                       </div>
                  
                        <?php endforeach;
                        wp_reset_postdata();

 

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注