Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Display Wordpress post day/month in HTML?
Old 02-25-2011, 06:33 PM Display Wordpress post day/month in HTML?
zomex's Avatar
Ultra Talker

Posts: 308
Name: Jack
Trades: 0
Hello everyone,

I'm currently working on displaying an excerpt of my Wordpress posts on my website. I've got everything working perfectly but I'd like to display the date of each post with a cool calendar background.

Currently I'm using the <?php the_date(); ?> tag which pulls the date of each post from the database in the following format:

month day, year

What I'd like to do is add the day and month in the following format:

<div class="calendar sprite-main">
day
<em>month</em>
</div>

Is it possible to achieve this? I have noticed that I can apply attributes to the tag but haven't found an option to get the date and month separately.

Thanks!
Jack
__________________

Please login or register to view this content. Registration is FREE
- Hosting over 200 websites!


Please login or register to view this content. Registration is FREE
from just $3.99/month

Please login or register to view this content. Registration is FREE
- 20% Lifetime Commissions!
Please login or register to view this content. Registration is FREE
zomex is offline
Reply With Quote
View Public Profile Visit zomex's homepage!
 
 
Register now for full access!
Old 02-25-2011, 06:37 PM Re: Display Wordpress post day/month in HTML?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://codex.wordpress.org/Function_Reference/the_date
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-25-2011, 07:04 PM Re: Display Wordpress post day/month in HTML?
zomex's Avatar
Ultra Talker

Posts: 308
Name: Jack
Trades: 0
Quote:
Originally Posted by chrishirst View Post
Thanks Christ, I found that page earlier but I failed to notice the important points

I managed to achieve what I wanted with the following:

Code:
<div class="calendar sprite-main">
<?php the_date('d'); ?>
<em><?php the_time('F'); ?></em>
</div>
Thanks for the help.
__________________

Please login or register to view this content. Registration is FREE
- Hosting over 200 websites!


Please login or register to view this content. Registration is FREE
from just $3.99/month

Please login or register to view this content. Registration is FREE
- 20% Lifetime Commissions!
Please login or register to view this content. Registration is FREE
zomex is offline
Reply With Quote
View Public Profile Visit zomex's homepage!
 
Old 02-26-2011, 01:28 PM Re: Display Wordpress post day/month in HTML?
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
When you want to do something with a variable from a WP function rather than echo it right away there is usually partner "get_" function. In this case get_the_time().

For example:

PHP Code:
$date_month get_the_time('F');
$date_day =  get_the_time('d'); 
The above will only "store" the variables but not echo them.
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Reply     « Reply to Display Wordpress post day/month in HTML?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13283 seconds with 12 queries