WordPress code
-
Hi everyone,
I am attempting to do some minor modifications to the home page of a wordpress instance.
The current code:
<div class="archive-post-header"> <p class="archive-post-date"><?php the_time(get_option('date_format')); ?></p> <?php if ( get_the_title() != '' ) : ?> <h2 class="archive-post-title"><?php the_title(); ?></h2> <?php endif; ?> </div>
I’d to change it to:
<div class="archive-post-header"> <p class="archive-post-date"><?php the_category( ', ' ); ?></p> <?php if ( get_the_title() != '' ) : ?> <h2 class="archive-post-title"><?php the_title(); ?></h2> <?php endif; ?> </div>
Basically, instead of outputing the date of the post, I’d like it to display the categories that the post is tagged with.
The above (second) piece of code is obviously not working, any of you with coding experience probably know why right away.
Any insight into how I can change the code to work?
I’m hoping i can still use the post date class, as I like the way it looks… could just copy it and make a new class, but if that works it works right?
- The topic ‘WordPress code’ is closed to new replies.