Home › Forums › Pro Support › CSS for Cards
- This topic has 17 replies, 4 voices, and was last updated 2 years, 11 months ago by
Tom.
-
AuthorPosts
-
September 28, 2020 at 6:22 am #20207
Alejandro
ParticipantHi,
I am trying to achieve something like this (https://imgur.com/a/vSaGXik). I am trying to see if any card design fits in, but I have not found any, so I presume that I’ll have to Css any of them.
Could you tell me how to proceed?Thank you
September 28, 2020 at 9:55 am #20226David Beckwith
ParticipantHi there,
how does that differ from the standard layout or the Base Card as seen here:
September 28, 2020 at 10:57 am #20235Alejandro
ParticipantHi!
There’s two differences. Everything is in spanish but:
1) Instead the simple date (i.e. November 26, 2018) y do have set up in my blog: Actualizado: November 26, 2018
2) I want to add the comments link but shaped like the image in my first message. Now, I got this (again in spanish, which is ok) in plain text, no bubbles: “Deja un comentario”.any thoughts?
Thanks you!
Alex
September 28, 2020 at 7:25 pm #20283elvin
ModeratorHi Alex,
1) To clarify, you want the date to be displayed with “Actualizado:” prefix?
If so, you can easily do that by adding this CSS code:
time.wp-show-posts-entry-date.published:before { display: inline-block; content: "Actualizado:"; margin-right: 5px; }
2) I’m not sure I understand. Can you explain a bit more? What did you mean by “shaped like the image in my first message”?
I’ve checked the image on your first message and it’s just plain layout wireframe.
Did you mean spacing? or perhaps, text alignment?
September 29, 2020 at 2:46 am #20298Alejandro
Participanthi,
Just to clarify, what I am trying to achieve is the same look that have my blog roll in Generate Press: https://imgur.com/a/lN5AWwf
To have the “actualizado” I had to modify the php code, it is not a css thing.Regards
September 29, 2020 at 2:30 pm #20341elvin
ModeratorJust to clarify, what I am trying to achieve is the same look that have my blog roll in Generate Press: https://imgur.com/a/lN5AWwf
Can you link us to the site in question? Perhaps we can borrow GP’s icons for WPSP list’s use by adding a CSS :before pseudo element using GP’s icon as reference.
To have the “actualizado” I had to modify the php code
Nice one. Yeah that’ll work. It’s a matter of preference. CSS will work too. 🙂
September 30, 2020 at 2:10 pm #20435Alejandro
ParticipantHere you go: https://proyectoviajero.com/blog/
best, Alex
October 1, 2020 at 8:03 pm #20528Tom
KeymasterThe CSS that Elvin provided should work for the date – no need to use PHP there.
As for the comments, are you trying to copy the style you’re using with GP? Where can we see your WPSP list?
Let us know 🙂
October 1, 2020 at 10:41 pm #20537Alejandro
ParticipantThanks Tom,
What do you mean with ” WPSP list ”Thanks,
Alex
October 2, 2020 at 11:27 am #20569Alejandro
ParticipantHi, have you found any solution for this? Regards
October 2, 2020 at 1:24 pm #20573Tom
KeymasterHi there,
I mean where can we see the list of posts being output by WPSP that you’re targeting? All I’m seeing at your URL is the GP posts.
Let me know 🙂
October 2, 2020 at 1:28 pm #20577Alejandro
ParticipantAh, here > https://proyectoviajero.com/consejos/consejos-para-volar/
or here > https://proyectoviajero.com/consejos/seguridad/thanks!
October 2, 2020 at 1:35 pm #20583Tom
KeymasterCool, and to confirm, you’re wanting to add the SVG icon before the comment text?
October 2, 2020 at 1:41 pm #20585Alejandro
ParticipantThat’s correct!
And also, I implemented this in Generatedpress and I would like to show the latest date that a post was updated.Thank you!
/* Filter post date to display latest date */
add_filter( ‘generate_post_date_output’, function( $output, $time_string ) {
$time_string = ‘<span class=”label”>Actualizado: </span><time class=”entry-date published” datetime=”%1$s” itemprop=”datePublished”>%2$s</time>’;if ( get_the_time( ‘U’ ) !== get_the_modified_time( ‘U’ ) ) {
$time_string = ‘<span class=”label”>Actualizado: </span><time class=”entry-date updated-date” datetime=”%3$s” itemprop=”dateModified”>%4$s</time>’;
}$time_string = sprintf( $time_string,
esc_attr( get_the_date( ‘c’ ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( ‘c’ ) ),
esc_html( get_the_modified_date() )
);return sprintf( ‘<span class=”posted-on”>%s</span> ‘,
$time_string
);
}, 10, 2 );October 3, 2020 at 11:13 am #20607Tom
KeymasterFor this you’ll need 1.2.0-alpha.3: https://wpshowposts.com/wp-show-posts-1-2-0/
To add an icon before the comments link, you can do this:
add_action( 'wpsp_before_comments_link', function( $settings ) { if ( 123 === (int) $settings['list_id'] ) { echo 'Your icon here'; } } );
And for the date, you can do this:
add_filter( 'wpsp_post_date_show_updated_only', '__return_true' ); add_filter( 'wpsp_date_output', function( $output, $settings, $time_string ) { $updated_time = get_the_modified_time( 'U' ); $published_time = get_the_time( 'U' ) + 1800; if ( $updated_time > $published_time ) { return sprintf( 'Actualizado: <span class="wp-show-posts-posted-on wp-show-posts-meta"> <a href="%1$s" title="%2$s" rel="bookmark">%3$s</a> </span>', esc_url( get_permalink() ), esc_attr( get_the_time() ), $time_string ); } return $output; }, 10, 3 );
-
AuthorPosts
- You must be logged in to reply to this topic.