Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在wordpress中设置php生成链接的样式_Php_Css_Wordpress - Fatal编程技术网

在wordpress中设置php生成链接的样式

在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(); ?

我的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(); ?>" 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>