我试图在标记文章中添加一个类,但是WordPress的函数阻止了我添加php。
<?php post_class() ?>我尝试了很多事情,比如:
<article id="post-<?php the_ID(); ?>" <?php post_class(); if (! is_sticky()) { echo "non-sticky";} ?> >但这门课没有增加..。
发布于 2015-05-22 14:32:50
将其作为参数添加到函数中:
<?php $sticky = !is_sticky() ? "non-sticky" : null; ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $sticky ); ?>>阅读有关此函数在医生里参数的更多信息。
https://stackoverflow.com/questions/30399357
复制相似问题