dongzhan7253 2011-11-02 16:51
浏览 33
已采纳

在Wordpress页面中使用包含标题的列

I'm a little bit of a newb when it comes to PHP, but know enough to get around and would like to know if this can be done. sample

I want to break my wordpress page into 2 columns, but also want to have the header in the 1st column.... along with other text. I don't want the header floating over both columns...

The second column will house images only...

is that possible? In my head it makes sense, but then when I try and work it out, I'm just not sure....

And I just got thinking... I have my home page static with the smooth slider on it, so that is now going to cause more grief.

Any help, advice or pointers would be greatly appreciated.

Thanks in advance

  • 写回答

1条回答 默认 最新

  • dtfbj24048 2011-11-02 17:39
    关注

    This is more CSS/HTML than PHP, however that's fine. The first thing you need to do is understand how to make a two column layout. Then you will need to have the post title in the first column, something like this:

    <article>
        <div id="col1">
            <h1>Post Title</h1>
            Lorem ipsum dolor sit amet...
        </div>
        <div id="col2">
            <img src="" />
        </div>
    </article>
    

    To make this into WordPress you will of course need to add the WordPress Tags:

    <div id="col1">
        <h1><?php the_title(); ?></h1>
        <?php the_content(); ?>
    </div>
    

    Finally, adding the image(s) on the right. It can be done easily using WordPress' built in functionality, if you only need one image: (Note you will have to add something in your theme's functions.php file as per the WordPress Docs)

    <div id="col2">
        <?php 
        if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
            the_post_thumbnail();
        } 
        ?>
    </div>
    

    To add multiple images, it gets more complex and you'll have to start looking for a plugin to achieve that goal.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用ESP8266连接阿里云出现问题
  • ¥15 被蓝屏搞吐了,有偿求帮解答,Ai回复直接拉黑
  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并