2016-07-06 124 views
0

下面是我的两个不同部分的html代码,我无法使它们在wordpress中动态化。如何在wordpress中制作一个网站动态内容

<section class="contact"> 
     <h1>how it works</h1> 
     <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis, molestias facere nam esse voluptatum cupiditate recusandae deleniti neque quidem! Expedita necessitatibus saepe tempore corporis magnam ut impedit ea tempora quae.Select the products you wish to order. request a quote, fill out all the required fields and upload your artwork. Zazzoo will be in contact with you withing 24 hours to confirm your order.</p> 
     <div class="button"> 
      <button type="button" class="btn btn-default">Contact us</button> 
     </div> 
    </section><!-- end of contact section --> 
    <section class="opportunity"> 
     <div class="row"> 
      <div class="col-lg-8 col-md-8 ideas"> 
       <h2>turn your ideas into reality</h2> 
       <hr/><p>weretrerum dolor sit amet, consectetur adipisicing elit. Dolor laudantium porro natus quo, sit ex nemo, nostrum pariatur ipsum, hic, officiis facilis enim debitis? Doloremque sequi sed ex quae, eaque.</p> 
      </div>     
      <div class="col-lg-4 col-md-4 opportunitycolumn"> 
       <h2>opportunity</h2> 
       <hr> 
       <br/> 
       <h3>Are you a designer?</h3> 
       <p>Send us your work and we will manage your print...</p> 
      </div> 
     </div> 
</section> 

如何将上面的代码转换为wordpress,从而使其变为动态?

+1

我并不完全相信你的问题就是它的ID调用它。请你简化一下吗? –

+0

@Gavin Thomas。当然......只是编辑了这个问题,希望它更有意义。谢谢 –

+1

<?php the_title()?> <?php the_content()?> – NooBskie

回答

0

这里是WordPress的一个基本的循环,从挑选一个类别最最近的一篇文章的例子:

<?php $get_posts = new WP_Query(array('cat' => 21)); // "'cat' => 21" replace with whichever category your post is in 
while($get_posts->have_posts()) : $get_posts->the_post(); ?> 
<section class="contact"> 
    <div> 

    <?php The_post_thumbnail('full'); ?> 

    <div> 
    <h1><?php the_title(); ?></h1> 
    <?php the_content(); ?> 
    </div> 

</div> 
</section> 

<?php endwhile; ?> 
<?php wp_reset_postdata(); // reset the query ?> 

<?php The_post_thumbnail('full'); ?>心不是你的情况需要但这是在功能图像设置为好。

你可以做很多事情循环,以定制的方式,你需要

Here是去更了解循环深度的参考。

如果你不想在一个类别提出后,你还可以通过专门通过以下(未测试)Reference

<?php 
    $post_id = 1; //changeme 
    $queried_post = get_post($post_id); 
    $title = $queried_post->post_title; 
    echo $title; 
    echo $queried_post->post_content; 
?>