使用代码手动设置文字新闻内容

我正在尝试设置位于 Single.php 文件中的 WP 帖子的样式, 对于此文件包含的记录

">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div  <?php post_class() ?> id="post-<?php the_ID(); ?>">
     <div class="card-header">
            <h2><a title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
     </div>
     <div class="card-body">
           <div class="entry">
                  <?php the_content(); ?>
            </div>
     </div>
</div>
<?php endwhile; endif; ?>

而且我不知道如何设计它,因为上述帖子中没有任何课程。 任何想法如何使用代码和手动设置我的内容样式???

oji6695 回答:使用代码手动设置文字新闻内容

You can do it with following code.

first you will have to declare a class 

<div  <?php post_class() ?> id="post-<?php the_ID(); ?>" <?php post_class("my-custom-css"); ?>>

now you define css in your theme css file

.my-custom-css{
//do css stuff here
}
本文链接:https://www.f2er.com/23024.html

大家都在问