Site logo

[Resolved] Remove entry-content from Post Format Image on Archive page

Home Forums Support [Resolved] Remove entry-content from Post Format Image on Archive page

Home Forums Support Remove entry-content from Post Format Image on Archive page

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2504072
    Manoj

    Hi

    Is there a way to remove the entry-content from Post Format Image stories on Archive page?
    Also the Excerpt text is not showing to all Post Format Image stories.

    Thanks

    #2504609
    David
    Staff
    Customer Support

    Hi there,

    do you have any custom functions or templates that would change the behaviour of the archives ?

    Reason i am asking, the posts in that archive are showing the Entry Content ( Full post content ) not the Entry Summary ( Excerpt ) that i would expect to see.

    #2505563
    Manoj

    Nope, I’m using the default template for Photos Archive page.
    If you see, there are two stories on the page and both are showing differently.

    – First one is showing the Entry Content (Full post content).
    – Second one is showing Entry Summary (Excerpt)

    Thanks

    #2506144
    David
    Staff
    Customer Support

    I think we would need a separate template for those, as the theme doesn’t have a content template for the image format.

    So if you have a child theme, you could save your own content-image.php template.
    And inside that add this:

    <?php
    /**
     * The template for displaying format image posts within the loop.
     *
     * @package GeneratePress
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly.
    }
    ?>
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
    	<div class="inside-article">
    		<?php
    		/**
    		 * generate_before_content hook.
    		 *
    		 * @since 0.1
    		 *
    		 * @hooked generate_featured_page_header_inside_single - 10
    		 */
    		do_action( 'generate_before_content' );
    
    		if ( generate_show_entry_header() ) :
    			?>
    			<header <?php generate_do_attr( 'entry-header' ); ?>>
    				<?php
    				/**
    				 * generate_before_entry_title hook.
    				 *
    				 * @since 0.1
    				 */
    				do_action( 'generate_before_entry_title' );
    
    				if ( generate_show_title() ) {
    					$params = generate_get_the_title_parameters();
    
    					the_title( $params['before'], $params['after'] );
    				}
    
    				/**
    				 * generate_after_entry_title hook.
    				 *
    				 * @since 0.1
    				 *
    				 * @hooked generate_post_meta - 10
    				 */
    				do_action( 'generate_after_entry_title' );
    				?>
    			</header>
    			<?php
    		endif;
    
    		/**
    		 * generate_after_entry_header hook.
    		 *
    		 * @since 0.1
    		 *
    		 * @hooked generate_post_image - 10
    		 */
    		do_action( 'generate_after_entry_header' );
    
    		/**
    		 * generate_after_entry_content hook.
    		 *
    		 * @since 0.1
    		 *
    		 * @hooked generate_footer_meta - 10
    		 */
    		do_action( 'generate_after_entry_content' );
    
    		/**
    		 * generate_after_content hook.
    		 *
    		 * @since 0.1
    		 */
    		do_action( 'generate_after_content' );
    		?>
    	</div>
    </article>
    

    That will remove the entry-content altogether

    #2506790
    Manoj

    Hi David,

    Thank you so much for the template code and it fixed the issue.

    #2506974
    David
    Staff
    Customer Support

    Glad to hear that!!

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