• Resolved manav kalra

    (@manavkalra15)


    Hello, Thanks for awesome theme. I am using your theme on my multiple sites from 2020.

    I am using Ajax Load more plugin to replace pagination with load more button on home & archive pages in generatepress.

    I copied Repeater Template for ajax plugin from theme content.php
    you can check below

    <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' );
    
    		$itemprop = '';
    
    		if ( 'microdata' === generate_get_schema_type() ) {
    			$itemprop = ' itemprop="text"';
    		}
    
    		if ( generate_show_excerpt() ) :
    			?>
    
    			<div class="entry-summary"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
    				<?php the_excerpt(); ?>
    			</div>
    
    		<?php else : ?>
    
    			<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
    				<?php
    				the_content();
    
    				wp_link_pages(
    					array(
    						'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
    						'after'  => '</div>',
    					)
    				);
    				?>
    			</div>
    
    			<?php
    		endif;
    
    		/**
    		 * 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>

    Load more button is working by using this repeater template. But, the only problem I am getting is “date, by author” after post title

    &

    “category, tag & leave a comment” after read more are not showing.


    Post title, featured image & post excerpt showing.

    Can anyone please tell me changes to make in above code to show “date, by author, category, tag & leave a comment” ?

    Thanks in Advance

Viewing 15 replies - 1 through 15 (of 27 total)
  • ying

    (@yingscarlett)

    Hi @manavkalra15

    The code is identical to GP’s default template file, so the elements you mentioned should’ve shown.

    Have you modified other GP files? Eg. post-meta.php?

    Let me know!

    Thread Starter manav kalra

    (@manavkalra15)

    No, I didn’t changed.

    Hi @manavkalra15,

    Can you provide the link to the site in question?

    Thread Starter manav kalra

    (@manavkalra15)

    For clarity, can you take a screenshot of the issue as well?

    Thread Starter manav kalra

    (@manavkalra15)

    Yes, You can check in below screenshot. After clicking load more, posts snippet don’t have Date, by author, category, tags, leave a comment.

    Only Title, featured image & post excerpt is available.

    Screenshot after clicking load more: https://prnt.sc/DBfKeQvS19ec

    • This reply was modified 1 year, 8 months ago by manav kalra.
    ying

    (@yingscarlett)

    I can see the posts before Ajax load are correctly loading GP’s template, but the posts after Ajax load are not.

    It can not be a GP issue, I would recommend reaching out to the Ajax plugin’s support.

    Let us know what their response is ??

    Thread Starter manav kalra

    (@manavkalra15)

    I tried same thing with another theme, in that theme everything working fine. So, I think there’s something to do with generatepress.

    I already contacted plugin support regarding this issue, they said there’s not any issue with plugin.

    Thread Starter manav kalra

    (@manavkalra15)

    Can you provide me direct php code snippet to show date, by author, category, tag, leave a comment, I think this will solve my issue. Instead of

    do_action( 'generate_after_entry_title' );
    
    do_action( 'generate_after_entry_content' );

    Try adding this snippet:

    add_filter( 'generate_header_entry_meta_items', function( $items ) {
    
        if ( is_single() ) {
            return array( 'author', 'date', 'comments-link', 'categories');
        }
    	return $items;
        
    } );
    
    add_action( 'wp', function() {
        if ( is_single() ) {
            add_filter( 'generate_show_comments', '__return_true' );
        } 
    } );

    Thread Starter manav kalra

    (@manavkalra15)

    I added this code, no changes. Still looking for solution.

    Thread Starter manav kalra

    (@manavkalra15)

    Hi @fernandoazarcon2,

    I never touched post-meta.php file, still I replaced whole post-meta.php with your provided source, still no change.

    I see. Did you edit content-single.php? If so, make sure the hooks and functions here are there: https://github.com/tomusborne/generatepress/blob/master/content-single.php

    Thread Starter manav kalra

    (@manavkalra15)

    No, I never touched content-single.php as well. Still, I replaced content-single.php with your provided source.

    I only copied template from content.php which I mentioned above i.e.

    <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' );
    
    		$itemprop = '';
    
    		if ( 'microdata' === generate_get_schema_type() ) {
    			$itemprop = ' itemprop="text"';
    		}
    
    		if ( generate_show_excerpt() ) :
    			?>
    
    			<div class="entry-summary"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
    				<?php the_excerpt(); ?>
    			</div>
    
    		<?php else : ?>
    
    			<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
    				<?php
    				the_content();
    
    				wp_link_pages(
    					array(
    						'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
    						'after'  => '</div>',
    					)
    				);
    				?>
    			</div>
    
    			<?php
    		endif;
    
    		/**
    		 * 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>
    
Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘Few elements not loading in post snippet when using AJax Load More’ is closed to new replies.