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.

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

报告相同问题?

悬赏问题

  • ¥20 MIT控制器能控制不稳定系统吗
  • ¥15 公司代码X对业务伙伴X无效,处理方法?
  • ¥15 微信内链接跳转到浏览器打开怎么实现
  • ¥15 三角波可以直接加施密特电路整形到矩形波吗实物
  • ¥15 html,php,在使用html请求php文件时发生了错误,无法请求到php文件读取数据库并用javascript进行数据显示,刷新
  • ¥15 touchsocket udp组播
  • ¥20 MAC怎么安装Silverlight 插件?以及安装了怎么启用
  • ¥15 VS2012中查询语句无法填入解析,数值传不进去
  • ¥15 gis系统开发出现命名空间“ESRI.ArcGIS”中不存在类型或命名空间名“Analyst3D”报错
  • ¥15 怎么让ai定时给我发信息 c#或者python