Archived topic
Custom posts list styling
5 replies · Started by Krzysztof on April 24, 2018
Hello, I am trying to achieve look of recent posts similar to http://www.mdk.gdynia.pl/ website.
Can anyone point me to the direction as with how can I achieve those dates above posts?
It would likely involve some custom HTML/PHP/CSS. What kind of blog layout do you have right now?
Right now I am using basic masonry layout from GP. Will add some styling, but can't figure a way to add date similar to that Joomla site.
Can you link me to your site? I might be able to help with some code.
Let me know :)
mdkpruszkow.pl
This is just a sketch, because now they are filling in posts, but it is basicly using Masonry on base layout of categories.
Ok, might take a couple goes, but we should be able to do this.
First step, adding the HTML:
add_action( 'generate_before_content', 'tu_add_custom_date' );
function tu_add_custom_date() {
if ( is_singular() ) {
return;
}
printf( '<div class="custom-date"><span class="day">%1$s</span><span class="month">%2$s</span></div>',
get_the_date( 'j' ),
get_the_date( 'M' )
);
}
Let me know when you get that added and we should be able to get the rest of the way with CSS :)