WordPress.org

Ready to get started?Download WordPress

Forums

Pinboard
[resolved] Adding date to grid thumbnails? (10 posts)

  1. cathytxtwfr
    Member
    Posted 1 year ago #

    Hi,
    I am a beginner so apologies if my question is very simple.

    How can I add the date to each grid post? I would like to place the date above each thumbnail in a small font size. I am not sure if this is something I do in CSS or in the template files.

    Here is my site: http://cathywu.com/journal/treadling/ - there is a thumbnail and post title, but i would like to also have the date show up.

    hank you for any help

    Cathy

  2. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    You would need to edit the php file -- and since it's not a good idea to modify theme files directly, you would need to first create a child theme.

  3. cathytxtwfr
    Member
    Posted 1 year ago #

    Thank you. I assume it is index.php I will need to edit/make a child theme then? Do you have a link to a tutorial you recommend for adding an entry date/modifying a .php ? Sorry I am a beginner at this but I am trying to learn.

  4. omggimme
    Member
    Posted 1 year ago #

    Hi Cathy,

    I've somewhat did it for my page, you can see the example here http://omggim.me

    I hope you already have your child theme installed. You will need to edit functions.php in your child theme and also add to the CSS in your dashboard.

    1. CSS:
    - go to your DASHBOARD > APPEARANCE > EDIT CSS
    - at the bottom just add the following few lines:

    .date-meta {
    	background-color: #000;
    	opacity: .5;
    	filter: alpha(opacity=50);
    	position: absolute;
    	padding: 5px;
    	top: 21px;
    	right: 20px;
    	color: #FFF;
    }

    - you will have to play around with your settings such as top, right, I am using the 4-coloumn format, so it might be a bit off for you.

    2. functions.php
    - Search for pinboard_post_thumbnail, around lines 1495 and replace the entire function with what I have below.

    function pinboard_post_thumbnail() {
    	if( has_post_thumbnail() ) : ?>
    
    		<figure class="entry-thumbnail">
                <div class="date-meta"><? echo get_the_time( get_option( 'date_format' ) );?></div>
    			<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
    				<?php the_post_thumbnail( ( pinboard_is_teaser() ? 'teaser-thumb' : 'blog-thumb' ) ); ?>
    			</a>
    		</figure>
    	<?php endif;
    }

    3. Save and refresh

  5. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    I hope you already have your child theme installed.

    Yes! Do not do any of these kinds of changes in theme files. And be sure to keep back-up copies as you do this kind of thing.

    But nice help on this modification!

  6. cathytxtwfr
    Member
    Posted 1 year ago #

    Hi!

    Thank you so much. It worked perfectly. (I made a child theme too) The date was also overlapping the image, and I couldn't figure out how to push my thumbnail down, so I just pushed the date up - works for me. Thank you again!

    Cathy

  7. cathytxtwfr
    Member
    Posted 1 year ago #

    Forgot to mention - its all resolved now! thank you.

  8. Mindscanner
    Member
    Posted 1 year ago #

    sorry for reopening this topic but what do i have to change to use the code for category on the tumbnails?

    ps im verry bad with CSS :(

    thx

  9. Andrew Nevins
    Volunteer Moderator
    Posted 1 year ago #

    If you require further support than that given in this thread, create your own thread on the issue. This thread is resolved.

  10. Mindscanner
    Member
    Posted 1 year ago #

    Sorry Andrew allready done it but i tryed this way to get faster reply.
    Bad misthake i see sorry i remember it for next time

    thx

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags