-6

我有一个 html 主题,并且想将其转换为 wordpress 主题,该主题中的项目部分将显示帖子并具有特殊结构,我的问题是编写一个 php 和 wordpress 函数,它可以显示相同的外观并获得帖子从管理面板,即使其动态化以明确问题请查看包含 html 主题的附件链接,我认为这可以通过 while 循环来完成。有人可以帮我写这个。

这是项目部分代码,我们希望将其转换为 php 代码:

<div id="home-presentation" class="custom-scroll">
        <div class="list">
            <div class="box">               

                <div class="fly first">
                    <h4><a href="portfolio.html">Projects</a></h4>
                </div>

                <div class="el_3 pos_3 fly big color_1">
                    <a href="portfolio_view.html" class="image">
                        <img src="images/temp/presentations/10/presentation.jpg" alt="backgrounds" > 
                        <span>
                        backgrounds
                        </span>
                        <ins></ins>
                    </a>
                </div>

                <div class="el_3 pos_7 fly without-image color_1">
                    <div class="project">
                    <span class="arrow top">&nbsp;</span><h5><a href="javascript:;">backgrounds</a></h5>
                    <p>Project: backgrounds</p>
                    <a href="portfolio_view.html" class="details" title="view details">view details</a>
                    <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>

                <div class="el_5 pos_8 fly color_1">
                    <a href="portfolio_view.html" class="image">
                    <img src="images/temp/presentations/60/presentation.jpg" alt="last one" > 
                    <span>
                    and last
                    </span>
                    <ins></ins>
                    </a>
                </div>

            </div>
            <div class="box">

                <div class="el_8 pos_1 fly big color_1">
                    <a href="portfolio_view.html" class="image">
                        <img src="images/temp/presentations/58/presentation.jpg" alt="customer 3" > 
                        <span>
                        customer 3
                        </span>
                        <ins></ins>
                    </a>
                </div>

                <div class="el_6 pos_5 fly color_1">
                    <a href="portfolio_view.html" class="image">
                        <img src="images/temp/presentations/54/presentation.jpg" alt="customer 1" > 
                        <span>
                        customer 1
                        </span>
                        <ins></ins>
                    </a>
                </div>

                <div class="el_6 pos_6 fly without-image color_3">
                    <div class="project">
                        <span class="arrow left">&nbsp;</span><h5><a href="javascript:;">customer 1</a></h5>
                        <p>Project: customer 1</p>
                        <a href="portfolio_view.html" class="details" title="view details">view details</a>
                        <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>

                <div class="el_5 pos_7 fly without-image color_3">
                    <div class="project">
                        <span class="arrow left">&nbsp;</span><h5><a href="javascript:;">last one</a></h5>
                        <p>Project: last one</p>
                        <a href="portfolio_view.html" class="details" title="view details">view details</a>
                        <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>

                <div class="el_9 pos_8 fly without-image color_1">
                    <div class="project">
                        <span class="arrow right">&nbsp;</span><h5><a href="javascript:;">customer 4</a></h5>
                        <p>Project: customer 4</p>
                        <a href="portfolio_view.html" class="details" title="view details">view details</a>
                        <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>
            </div>

            <div class="box">
                <div class="el_8 pos_1 fly without-image color_1">
                    <div class="project">
                        <span class="arrow left">&nbsp;</span><h5><a href="javascript:;">customer 3</a></h5>
                        <p>Project: customer 3</p>
                        <a href="portfolio_view.html" class="details" title="view details">view details</a>
                        <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>

                <div class="el_7 pos_2 fly without-image color_3">
                    <div class="project">
                        <span class="arrow right">&nbsp;</span><h5><a href="javascript:;">customer 2</a></h5>
                        <p>Project: customer 2</p>
                        <a href="portfolio_view.html" class="details" title="view details">view details</a>
                        <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>

                <div class="el_10 pos_3 fly color_1">
                    <a href="portfolio_view.html" class="image">
                        <img src="images/temp/presentations/63/presentation.jpg" alt="customer 5" > 
                        <span>
                        customer 5
                        </span>
                        <ins></ins>
                    </a>
                </div>

                <div class="el_10 pos_4 fly without-image color_1">
                    <div class="project">
                        <span class="arrow left">&nbsp;</span><h5><a href="javascript:;">customer 5</a></h5>
                        <p>Project: customer 5</p>
                        <a href="portfolio_view.html" class="details" title="view details">view details</a>
                        <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>

                <div class="el_9 pos_5 fly big color_1">
                    <a href="portfolio_view.html" class="image">
                        <img src="images/temp/presentations/62/presentation.jpg" alt="customer 4" > 
                        <span>
                        customer 4
                        </span>
                        <ins></ins>
                    </a>
                </div>
            </div>
            <div class="box">
                <div class="el_7 pos_1 fly big color_1">
                    <a href="portfolio_view.html" class="image">
                        <img src="images/temp/presentations/65/presentation.jpg" alt="customer 2" > 
                        <span>
                        customer 2
                        </span>
                        <ins></ins>
                    </a>
                </div>

                <div class="el_4 pos_5 fly color_1">
                    <a href="portfolio_view.html" class="image">
                        <img src="images/temp/presentations/48/presentation.jpg" alt="free and safe" > 
                        <span>
                        free and safe
                        </span>
                        <ins></ins>
                    </a>
                </div>

                <div class="el_4 pos_6 fly without-image color_3">
                    <div class="project">
                        <span class="arrow left">&nbsp;</span><h5><a href="javascript:;">free and safe</a></h5>
                        <p>Project: free and safe</p>
                        <a href="portfolio_view.html" class="details" title="view details">view details</a>
                        <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>

                <div class="el_5 pos_7 fly without-image color_3">
                    <div class="project">
                        <span class="arrow right">&nbsp;</span><h5><a href="javascript:;">last one</a></h5>
                        <p>Project: last one</p>
                        <a href="portfolio_view.html" class="details" title="view details">view details</a>
                        <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>

                <div class="el_5 pos_8 fly color_1">
                    <a href="portfolio_view.html" class="image">
                        <img src="images/temp/presentations/50/presentation.jpg" alt="last one" > 
                        <span>
                        last one
                        </span>
                        <ins></ins>
                    </a>
                </div>

            </div>
            <div class="box">               

                <div class="fly last">
                <p><a href="http://dev.creativex.bg/svn/vladi/CreativeX/bg/portfolio/">Всички</a></p>

                <h6><a href="http://dev.creativex.bg/svn/vladi/CreativeX/bg/portfolio/"><span>453</span>Projectа</a></h6>
                </div>

                <div class="el_3 pos_1 fly color_1">
                    <a href="portfolio_view.html" class="image">
                        <img src="images/temp/presentations/46/presentation.jpg" alt="backgrounds" > 
                        <span>
                        background image
                        </span>
                        <ins></ins>
                    </a>
                </div>

                <div class="el_3 pos_2 fly without-image color_1">
                    <div class="project">
                        <span class="arrow left">&nbsp;</span><h5><a href="javascript:;">backgrounds</a></h5>
                        <p>Project: background image</p>
                        <a href="portfolio_view.html" class="details" title="view details">view details</a>
                        <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>

                <div class="el_2 pos_3 fly without-image color_1">
                    <div class="project">
                        <span class="arrow right">&nbsp;</span><h5><a href="javascript:;">test 2</a></h5>
                        <p>Project: test 2</p>
                        <a href="portfolio_view.html" class="details" title="view details">view details</a>
                        <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>

                <div class="el_2 pos_4 fly color_1">
                    <a href="portfolio_view.html" class="image">
                        <img src="images/temp/presentations/70/presentation.jpg" alt="test 2" > 
                        <span>
                        test 2
                        </span>
                        <ins></ins>
                    </a>
                </div>

                <div class="el_1 pos_5 fly color_1">
                    <a href="portfolio_view.html" class="image">
                        <img src="images/temp/presentations/71/presentation.jpg" alt="testovi danni" > 
                        <span>
                        testovi danni
                        </span>
                        <ins></ins>
                    </a>
                </div>

                <div class="el_1 pos_6 fly without-image color_3">
                    <div class="project">
                        <span class="arrow left">&nbsp;</span><h5><a href="javascript:;">testovi danni</a></h5>
                        <p>Project: testovi danni</p>
                        <a href="portfolio_view.html" class="details" title="view details">view details</a>
                        <a href="portfolio_view.html" class="live" title="go live">go live</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
4

1 回答 1

0
<?php $vik=1  query_post('showposts');

  while(have_posts()): the_post();
  ?>
   <li class="test<?php echo $vik; ?>">
   <?php the_title();
    the_content()
    the_permalink();
     ?>
    </li>
   <?php 
  $vik++;
endwhile; wp_reset_query(); ?>

尝试使用以下或遵循 wordpress codex 功能规则希望这将有助于您制作动态帖子

于 2013-07-29T10:47:45.103 回答