AFAIK WordPress provides NO way or method for bolding-out or underlining those dates in calendar that contains one or more posts. Is it true or am I missing something?
This is a rather strange situation for me. Even more strange, because proper styling of current date is added to WP.
I found out a workaround this and would like to share it in here – so maybe someone find it useful. Since it requires “digging” in WP core, it is recomended to perform this only by advanced users and to backup changed file.
Here is “my” trick:
1. Open “general-template.php” from “wp-includes” folder in any editor.
2. Locate line 716 or the one containing:
echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"$ak_titles_for_day[$day]\">$day</a>";
3. Between “a“, and “href” put a name of some CSS class. It is good idea to use some exotic name to not run into collision with some WP predefined class. In my example I chose calendar-post-link, so the whole line would look like this:
echo '<a class="calendar-post-link" href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"$ak_titles_for_day[$day]\">$day</a>";
4. Send updated file to FTP server, replacing original one with it.
5. Open CSS file “style.css” of the theme you use and add there declaration of calendar-post-link class (or any other name you used) along with styling you would like to attach to dates in your calendar that has some posts.
You don’t have to do all above “magic” if you would like to bold-out or underline or style in any way current date – as WP has proper style for it. All you have to do is to insert declaration for td#today to CSS file “style.css” of the theme you use.
I would apperciate any opinions about my “trick”. Since – as I told – it requires “digging” in WP core I would be happy if someone would enlighten me with an easier and more secure way to achieve this. If there is any…
- The topic ‘Calendar: Bolding-out dates with post’ is closed to new replies.