• Resolved gvaslin

    (@gvaslin)


    Hi,

    How can I do to display the same picture between all the posts listed in a category page ? I’d like to add a post separator.
    Thanks for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • you could try to add an action to 'the_post';
    https://codex.www.ads-software.com/Plugin_API

    example code, to be added into functions.php of your (child) theme:

    //a separator image in the category archive posts list//
    add_action( 'the_post', 'category_archive_posts_list_separator_image' );
    
    function category_archive_posts_list_separator_image() {
    	global $wp_query;
    	if( !is_category() ) return;
    	if( $wp_query->current_post > 0 )
    		echo '<img class="category-list-separator" src="https://example.com/your_image_location/your_image.jpg" />';
    }
    Thread Starter gvaslin

    (@gvaslin)

    IT WORKS ! Thank you very much Michael !
    You made my day ! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add a custom image between each post’ is closed to new replies.