Wordpress在post_类之后添加类

Wordpress在post_类之后添加类,wordpress,Wordpress,我试图在标签文章中添加一个类,但是WordPress的功能阻止我添加php <?php post_class() ?> 我尝试了很多东西,比如: <article id="post-<?php the_ID(); ?>" <?php post_class(); if (! is_sticky()) { echo "non-sticky";} ?> > 将其作为参数添加到函数中: <?php $sticky = !is_sticky()

我试图在标签文章中添加一个类,但是WordPress的功能阻止我添加php

<?php post_class() ?>

我尝试了很多东西,比如:

<article id="post-<?php the_ID(); ?>" <?php post_class(); if (! is_sticky()) { echo "non-sticky";} ?> >

将其作为参数添加到函数中:

<?php $sticky = !is_sticky() ? "non-sticky" : null; ?>

<article id="post-<?php the_ID(); ?>" <?php post_class( $sticky ); ?>>


.

将其作为参数添加到函数中:

<?php $sticky = !is_sticky() ? "non-sticky" : null; ?>

<article id="post-<?php the_ID(); ?>" <?php post_class( $sticky ); ?>>


.

将其作为参数添加到函数中:

<?php $sticky = !is_sticky() ? "non-sticky" : null; ?>

<article id="post-<?php the_ID(); ?>" <?php post_class( $sticky ); ?>>


.

将其作为参数添加到函数中:

<?php $sticky = !is_sticky() ? "non-sticky" : null; ?>

<article id="post-<?php the_ID(); ?>" <?php post_class( $sticky ); ?>>


.

我试过这样的方法,但没有成功。非常感谢。我试过这样的方法,但没有成功。非常感谢。我试过这样的方法,但没有成功。非常感谢。我试过这样的方法,但没有成功。非常感谢。