Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I know this is not difficult. I know it is supposed to be in the style.css in the child theme, but no font size I change seems to make any difference. The titles of the posts on my homepage never. get. any. smaller. Can anyone tell why? I don't need the lettering to be seen from across the room, so it would be great to resolve this.

Also, I'd like to add the date underneath the titles. (?)

internalcompass.us/castle

<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * For example, it puts together the home page when no home.php file exists.
 *
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */

get_header(); ?>

<?php ?>
<div id="primary" class="site-content">
    <div id="content" role="main">

    <div style="margin-bottom: 20px;">
        <?php easyrotator_display_rotator('erc_92_1372974446'); ?>
    </div>


    <?php if ( have_posts() ) : ?>

        <?php /* Start the Loop */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part( 'content', get_post_format() ); ?>
        <?php endwhile; ?>

        <?php twentytwelve_content_nav( 'nav-below' ); ?>

    <?php else : ?>

        <article id="post-0" class="post no-results not-found">

        <?php if ( current_user_can( 'edit_posts' ) ) :
            // Show a different message to a logged-in user who can add posts.
        ?>
            <header class="entry-header">
                <h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1>
            </header>

            <div class="entry-content">
                <p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p>
            </div><!-- .entry-content -->

        <?php else :
            // Show the default message to everyone else.
        ?>
            <header class="entry-header">
                <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
            </header>

            <div class="entry-content">
                <p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
                <?php get_search_form(); ?>
            </div><!-- .entry-content -->
        <?php endif; // end current_user_can() check ?>

        </article><!-- #post-0 -->

    <?php endif; // end have_posts() check ?>

    </div><!-- #content -->
</div><!-- #primary -->
share|improve this question
    
The font change is probably a pure CSS question and would be off topic per the faq but printing the "date" wouldn't be so post your code for the homepage please. –  s_ha_dum Jul 15 '13 at 20:42
add comment

1 Answer

Adding the date is potentially as simple as inserting the_time() in the appropriate place in the template if you're editing the template files.

However, it looks like you're using a child theme, so we have to use Wordpress's system of filters.

To add the date to the post, try filtering the titles. Add this to your functions.php:

function add_dates_to_title_wpse106605($title, $id) {
    if (is_home() && in_the_loop()) {
        $time = get_the_time( $d = 'l, F j, Y', $post = $id );
        return $title . '<br><small class="time">' . $time . '</small>';
    } else {
        return $title;
    }
}

add_filter('the_title', 'add_dates_to_title_wpse106605', 10, 2);

You can see that I've configured the $time to be output with the 'l, F j, Y' bit. Check out the Formatting Dates And Times page for more info on that syntax. It's pretty straightforward.

You'll also notice that I prepended it with a <br> tag to move it onto the next line and wrapped it in in a <small> tag. I'd recommend getting rid of the <br> and just forcing it into the next line by targeting it in the CSS and adding display: block;. Obviously, change the HTML to suit your needs.

For the CSS change, you need to have at least the same amount of specificity as what you're trying to override. The easiest way to do that is just to copy it. This should do the job:

@media screen and (min-width: 600px) {
    .entry-header .entry-title {
        font-size: 18px;
    }
}

Obviously change the size to suit your tastes.

share|improve this answer
    
Oh my gosh, thanks so much. I'm a little concerned about the bad practice aspect bc I just added a Plugin for the Slider which is called Easy Rotator, but regardless: I actually meant to change the font size of the Post Titles, of all the blog post previews below the Photo Slider. That's the same place I'd want to add the date. Thanks for mentioning Chrome Web Inspector. I'd mostly used Firebug even in Chrome, so it's good to know what tool is more recommended in this browser. –  kelly Jul 15 '13 at 21:07
    
Answer edited - I hope this helps you out. By the way, I'd definitely recommend switching out that slider for something else - there are tons of options out there. I think Jetpack (made by the Wordpress developers) includes a carousel: wordpress.org/plugins/jetpack –  Magnakai Jul 15 '13 at 22:06
    
thx. the font size edit worked which made my day. got an error with the first code in functions.php .. ah, i win some i lose some –  kelly Jul 16 '13 at 0:11
    
@kelly, what is the error? Are you putting the code at the end of your functions.php, but before any closing php tags? –  Magnakai Jul 16 '13 at 6:15
    
yes, do you mind looking at it again because i have changed the page to be showing two loops in two columns, and i think that is why it isn't working. i don't get an error, it just doesn't show any dates. –  kelly Jul 21 '13 at 3:50
show 6 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.