Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #534626

    Hey everyone,

    I am wondering if i can achieve the following:

    In blog there is an image shown on the left. What i want is to remove that image and replace it with the date of the post, or move all the meta on the left.

    You can see something similar here

    Thanks in advance.

    • This topic was modified 9 years ago by mike.rav.
    #534902

    Hey george!

    We can point you in the right direction for this but to get it looking exactly like your screenshot would take a lot of time and code and would have to be considered custom work.

    Around line 140 in the /enfold/includes/loop-index.php file you can see where the small preview image is displayed.

    $blog_meta_output = "<a href='{$link}' class='small-preview' title='{$featured_img_desc}'>".$slider.$icon."</a>";
    

    What your wanting is to replace that with the date so you can keep using the_time(), https://codex.wordpress.org/Function_Reference/the_time, to display certain parts of the date to create that look.

    Cheers!
    Elliott

    #535282

    Thanks for the reply.

    I understand what you mean, i just wanted the right direction :)

    well i found the line, and used the following

    $blog_meta_output = "<?php echo get_the_time(); ?>".$slider.$icon."";

    but the date is not displayed, i tried various formats and date codes, but none work. Am i not placing it correctly?

    #536365

    Hey, sorry to bump this, but can you help?

    #536579

    Hi!

    Please change your code to following one

    $blog_meta_output = get_the_time(get_option('date_format')).$slider.$icon;

    Best regards,
    Yigit

    #536597

    Hey,

    Thanks for this it works.

    Is it possible though to get each component of date individually?

    For example: get_the_time (only month), get_the_time (only year), get_the_time (only day), in order to wrap them in span classes and style them accordingly.

    #537582

    Hey!

    That would look something like this.

    $blog_meta_output = "<span>".get_the_time('d')."</span><span>".get_the_time('Y')."</span>".$slider.$icon;
    

    Best regards,
    Elliott

    #537867

    Wow, exactly what i wanted, thank you so much for this!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Replace picture with date for Blog Single Author Small’ is closed to new replies.