隐藏标题是wordpress帖子没有标题

时间:2012-08-21 19:44:15

标签: wordpress

我相信事情变得越来越温暖,没有标题正确显示空白,但标题现在不是链接也不是h2,它只是平面文字。有什么建议吗?

       <?php if (the_title()) { ?>

         <h2>
         <a href="'<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
         <?php the_title(); ?></a></h2>

       <?php } else { ?><?php }; ?>

1 个答案:

答案 0 :(得分:1)

<?php if (get_the_title() != "") { ?>
    <h2><a href="'<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php } ?>

应该工作。

相关问题