wordpress - How to add a class within php -
i have code working pull in posts 1 category onto page in wordpress:
<?php query_posts('cat=28'); while (have_posts()) : the_post(); the_title(); the_content(); endwhile; ?>
what want able add css class both title , content. know little php maybe explain trying do.
<?php query_posts('cat=28'); while (have_posts()) : the_post(); <div class="title-class">the_title();</div> <div class="content-class">the_content();</div> endwhile; ?>
i know way off hope can lowly front end designer :)
use :
<?php query_posts('cat=28'); while (have_posts()) : the_post(); ?> <div class="title-class"><?php the_title(); ?></div> <div class="content-class"><?php the_content(); ?></div> <?php endwhile; ?>
or
<?php query_posts('cat=28'); while (have_posts()) : the_post(); echo '<div class="title-class">'.the_title().'</div>'; echo '<div class="content-class">'.the_content().'</div>'; endwhile; ?>
Comments
Post a Comment