[Resolved] date label with an icon at the beginning in blog lists and post titles

Home Forums Support [Resolved] date label with an icon at the beginning in blog lists and post titles

Home Forums Support date label with an icon at the beginning in blog lists and post titles

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #2001344
    Halil

    Hi,
    I’d like to add date icon to date labels that appear under post titles in both single posts and blog posts list.

    Also I’d like to increase its font size a bit.

    How can I achieve that?

    #2001924
    Ying
    Staff
    Customer Support

    Hi Halil,

    You can try this CSS:

    span.posted-on:before {
        content: "";
        display: inline-block;
        background-image: url('svg-link');
        background-size: 20px 20px;
        height: 20px;
        width: 20px;
    }
    
    span.posted-on {
        font-size: 20px;
    }

    Replace the svg-linkwith your image URL.

    Let me know if you need further assistance 🙂

    #2002030
    Halil

    great help!

    I tried to lift up text part of the date for a few px so that icon and text’s center lines are aligned, tried margin-padding without success.

    If you can help me with that too, I’m totaly done Ying!

    #2002034
    Halil

    and instead of img url can we use <svg xmlns= …. </svg> markup?

    #2002111
    Ying
    Staff
    Customer Support

    tried to lift up text part of the date for a few px so that icon and text’s center lines are aligned, tried margin-padding without success.

    Try change this CSS :

    span.posted-on {
        font-size: 20px;
    }

    to:

    span.posted-on {
        font-size: 20px;
        display: flex;
        align-items: center;
    }

    and instead of img url can we use <svg xmlns= …. </svg> markup?

    Not using this method, background image can only be used as URL.

    If you want to use <SVG>without uploading the <SVG> to your server, you can give the block element – post meta template a try:
    https://docs.generatepress.com/article/block-element-post-meta-template/

    In this way you can use Headline block to add the <SVG> to the icon field.

    #2002132
    Halil

    that’s great ! I need to play with these element things, looks powerful and flexible. huge thanks Ying.

    #2003356
    Ying
    Staff
    Customer Support

    You are welcome 🙂

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.