drde3456 2014-08-22 12:16
浏览 67

避免在WordPress主题中重复表td

I have created my first WordPress Theme from HTML and I want to add a space to the right hand side of my blog posts with profile information and links to other sites etc..

I am using the below code and it seems to repeat the table td where I would like to add the profile and other information?

Can anyone shed some light on a solution for this? To see what it looks like.

<table style="width: 1000px; height: 150px" cellspacing="0" cellpadding="0" align="center">
    <tr>
        <td style="width: 740px">    
            <table style="width: 740px" cellspacing="0" cellpadding="0" align="center">
                <tr>
                    <td style="width: 200px; height: 44px" background='Date.jpg'>
                        <h2>
                        <?php the_time('F jS, Y'); ?>
                    </h2>
                </td>
                <td style="width: 540px; height: 44px" background='Title.jpg'>
                    <h4>
                        " rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                    </h4>
                </td>
            </tr>
            <tr>
                <td colspan="2">

                    <div class="entry">
                    <?php the_content(); ?></div>

                </td>
            </tr>
            <tr>
                <td style="height: 44px" background='Comments.jpg'>
                    Posted By <?php the_author_posts_link(); ?>
                </td>
                <td style="height: 44px" background='Comments.jpg'>
                    in <p class="postmetadata"><?php _e( 'Posted in' ); ?> <?php the_category( ', ' );    ?></p>
                </td>
            </tr>
        </table>

    </td>
    <td style="width: 260px">
        SIDEBAR AND PROFILE TAGS HERE</td>
    </tr>
</table>

How I can fix this issue in the index.php?

  • 写回答

1条回答 默认 最新

  • dongluo9156 2014-08-22 12:42
    关注

    The problem is that you're printing your table inside The Loop. That sidebar <td style="width: 260px"> is being printed at every post. It is not a sidebar for all posts, it's just an individual sidebar to each post.

    You'll need to read about Theme Development at the Codex to understand theme structures and best practices.

    The reference to 1998 made in a comment is that tables are not used for layout purposes since long ago, see Why not use tables for layout in HTML?.
    I'd suggest that you search for Starter Themes (like this) to build upon. For complete, exemplary, themes look for WordPress default ones, from Twenty Ten to Twenty Fourteen, to see how themes evolved in the last years.

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测