skip to Main Content

im trying to style my WP post which is located in Single.php file ,
for the record this file contains

“>

<?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; ?>

and i dont know how to style it cus there are no classes for anything in the said posts .
any ideas how to style my content with code and manually ???

2

Answers


  1. 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
    }
    
    Login or Signup to reply.
  2. You can give it a class name and then create a custom css for the just created style

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search