如果不在Wordpress的另一页上,则内容不会显示在一页中,而是会显示

时间:2019-03-14 06:33:15

标签: php html wordpress custom-wordpress-pages

我在Wordpress的一页上显示内容时遇到问题。

englishcollege website

那是我正在工作的网站的链接,我只是第一次体验它,已经在寻找任何可能的解决方案,但是没有一个能按照我的意愿工作。

<?php
/**
  Template Name: Arabic
  Template Post Type: post, page, arabic_content
 */

get_header(); 
?>
<!-- Start Main Slider -->
        <section id="main-slider">
            <!-- Carousel -->
            <div id="main-slide" class="main-slider carousel slide" data-ride="carousel">
                <!-- Carousel inner -->
                <div class="carousel-inner">
                    <?php 
                                $args = array(
                                    'post_type' => 'home_banner',
                                    'posts_per_page' => -1 ,
                                    'order'=> 'ASC'
                                );
                                $banners = new WP_Query( $args );

                                if ( $banners->have_posts() ) {
                                    $i=1;
                                    while ( $banners->have_posts() ) : $banners->the_post(); 
                            ?>
                            <div class="item <?php if($i == 1){?> active<?php }?>">
                                <img src="<?php echo wp_get_attachment_url(get_post_thumbnail_id($post->ID)); ?>" alt="">
                            </div>
                            <?php
                            $i++;
                            endwhile; // end of the loop. 
                        }
                        wp_reset_postdata();
                    ?>

                </div>

            </div>
            <div class="skewbot"><img src="<?php echo get_template_directory_uri();?>/images/skewbot.png" alt="" class="img-responsive" /></div>
            <!-- /carousel -->
        </section>
        <!-- End Main Slider -->

        <!-- Welcome Area -->
        <?php if ( is_page(2068) ) { ?>
        <section class="home-welcome">
            <div class="container">         
                <div class="row">
                    <div class="col-md-7 col-sm-7">
                        <div class="section-heading">
                            <?php
                                // Start the loop.
                            while ( have_posts() ) : the_post();

                            the_content();

                            endwhile;
                            ?> 
                        </div>
                         <div class="clearfix"></div>
                        <!--<div class="welcome_btnrow">
                            <div class="viewmorerow"><a href="#" class="viewmore"><span>Admission Enquiry</span></a></div>
                        </div>-->
                    </div>                    
                    <div class="col-md-5 col-sm-5">
                        <img src="<?php echo wp_get_attachment_url(get_post_thumbnail_id($post->ID)); ?>" alt=""/>
                    </div>
                </div>
            </div>
        </section>
        <?php } ?>

        <!-- Welcome Area -->

        <hr>

        <!-- Principal Message Start here-->
        <p>
            Display in the middle
        </p>
        <?php if (is_page(2117)) {?>
        <?php
        $principals_name = get_post_meta($post->ID,'principals_name_arabic',true);
        $principals_address = get_post_meta($post->ID,'principals_address_arabic',true);
        $principals_cotation = get_post_meta($post->ID,'principals_cotation_arabic',true);      
        ?>
        <section class="principalsec">
            <div class="container">
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-5 col-lg-5 pull-right">
                        <div class="aboutimg">
                            <img src="http://www.englishcollege.ac.ae/wp-content/uploads/2018/07/principalimg1-2.jpg" alt=""/>

                            <div class="principalname">
                                <h4><?php if($principals_name != ""){ echo $principals_name; }  ?></h4>
                                <p><?php if($principals_address != ""){ echo $principals_address; }  ?></p>
                            </div>
                        </div>
                        <div class="principaltest">
                            <img src="<?php echo get_template_directory_uri(); ?>/images/princi_img.jpg" alt=""/>
                            <div class="principaltestcon">
                                <p><?php if($principals_cotation != ""){ echo $principals_cotation; }  ?></p>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
                        <div class="abouttext">
                            <?php
                            if ( have_posts() ) : while ( have_posts() ) : the_post();

                                the_content();

                                endwhile;
                                else:
                                    _e('Sorry, no content display so far.');
                            endif;
                            ?> 
                            <img src="<?php echo get_template_directory_uri(); ?>/images/sig.jpg" alt=""/>
                            <h6><?php if($principals_name != ""){ echo $principals_name; }  ?></h6>
                            <span><?php if($principals_address != ""){ echo $principals_address; }  ?></span>

                        </div>
                    </div>
                </div>
            </div>
        </section>
        <?php }?>
        <!-- Principal Message ends here-->

        <hr>



        <section style="padding:30px 0; padding-left:9em;">
            <div class="container">
                <div id="owl-demo2" class="owl-carousel owl-theme">
                    <?php 
                                $args = array(
                                    'post_type' => 'partners',
                                    'post_status' => 'publish',
                                    'posts_per_page' => -1 ,
                                    'order'=> 'ASC'
                                );
                                $partners = new WP_Query( $args );

                                if ( $partners->have_posts() ) {
                                    $i=1;
                                    while ( $partners->have_posts() ) : $partners->the_post(); 
                            ?>
                    <div class="item">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <img src="<?php echo wp_get_attachment_url(get_post_thumbnail_id($post->ID)); ?>" alt="partners" class="img-responsive" />
                    </div>
                               <?php
                                    $i++;
                                    endwhile; // end of the loop. 

                                    }
                                    wp_reset_postdata();
                                ?>
                </div>
            </div>
        </section>

 <?php 
get_footer();
?>

这是我的阿拉伯语页面的阿拉伯语模板的完整代码。正如您在网站上看到的那样,有一个段落标签说

  

显示在中间

我要输入的内容是这个page

不添加headerfooter,因为它已经在模板中了。所以我的问题是。

如何将其放在同一页面模板上并在阿拉伯语页面上显示这些内容?还是我做错了什么需要开发或重新输入?希望您能提供一些答案和建议。

0 个答案:

没有答案