在wordpress中设置php生成链接的样式
我的wordpress循环中有以下代码来显示粘性帖子:在wordpress中设置php生成链接的样式,php,css,wordpress,Php,Css,Wordpress,我的wordpress循环中有以下代码来显示粘性帖子: <div class="blogpost"> <?php // div class for styling sticky posts on main page. ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?> <h2><a href="<?php the_permalink(); ?
<div class="blogpost">
<?php // div class for styling sticky posts on main page. ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); // Show summary of posts only. ?>
</div> <!-- end class sticky -->
</div> <!-- end class blogpost -->
第一个代码块在
之后缺少一个
。因此,您应该能够在修复后设置h2
的样式
如果要将h2
放在a
中,可以将其放在:
点击代码的这一部分
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>
第二个代码段有html语法错误。。。将被视为post-324 div的一个属性。我知道。第二个片段是Firebug在我查看Firefox中的代码时给我的。但我不知道这是为什么和怎么发生的。
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="blogpost">
<div id="post-<?php the_ID(); ?>" <?= post_class(); ?>>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?= the_title(); ?></a></h2>
<?php the_excerpt(); ?>
</div>
</div>