-
AuthorPosts
-
November 12, 2015 at 9:36 am #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 10 years ago by
mike.rav.
November 12, 2015 at 5:08 pm #534902Hey 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!
ElliottNovember 13, 2015 at 8:46 am #535282Thanks 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?
November 16, 2015 at 8:37 am #536365Hey, sorry to bump this, but can you help?
November 16, 2015 at 4:18 pm #536579Hi!
Please change your code to following one
$blog_meta_output = get_the_time(get_option('date_format')).$slider.$icon;Best regards,
YigitNovember 16, 2015 at 4:29 pm #536597Hey,
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.
November 17, 2015 at 7:04 pm #537582Hey!
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,
ElliottNovember 18, 2015 at 8:40 am #537867Wow, exactly what i wanted, thank you so much for this!
-
This topic was modified 10 years ago by
-
AuthorPosts
- The topic ‘Replace picture with date for Blog Single Author Small’ is closed to new replies.
