• Resolved Matt Lovett

    (@mdeluk)


    Hi there

    Hoping someone can help with this.

    I am trying to customise this widget so that I can add a line (hr tag) below each post in the list.

    I read here we can add content after a post: https://jetpack.com/2016/01/12/hooks-customize-top-posts-pages-widget/

    However when doing this it adds it before the end of </li> tag, causing the line to appear not below the whole content but to the side of the image.

    The <hr> tag needs to be inserted after the </li> tag – is this possible?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Matt Lovett

    (@mdeluk)

    Just to follow up on this, the actual code I am using for this is:

    function jetpackme_add_date_top_posts( $post_id ) {
            $post_date = get_post_time(
                    get_option( 'date_format' ),
                    true,
                    $post_id,
                    true
            );
            printf( '<hr>', $post_date );
    }
    add_action( 'jetpack_widget_top_posts_after_post', 'jetpackme_add_date_top_posts' );
    

    Hello there, Matt!

    Custom code or any design-related items are definitely outside the scope of our support – The best options for help on that would be your web host or to hire a developer / designer.

    The only official information we can give are the hooks and filters mentioned here and in the articles that are linked, one of them, that you have found:

    https://jetpack.com/support/extra-sidebar-widgets/top-posts-pages-widget

    So, I wouldn’t be able to help you with that directly, but I hope this points you in the right direction!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Top posts customisation’ is closed to new replies.