[Support request] generate_before_entry_title not working in WP Query loop

Home Forums Support [Support request] generate_before_entry_title not working in WP Query loop

Home Forums Support generate_before_entry_title not working in WP Query loop

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #1624310

    Hi guys,

    When I’m trying to loop through posts on the homepage with code in a custom template, and for each post use a template part that contains code very similar to the ‘content-single.php’ file, generate_before_entry_title and other do_action’s are not working, and therefore not showing post categories, date and Read more buttons.

    What am I doing wrong? I’ve tried setting up postdata but that doesn’t help.


    Customer Support


    Can you share us the code you’re using?

    generate_before_entry_title doesn’t do anything by itself, it’s a hook location.

    The one in charge of generating meta is function is found in generatepress/inc/structure/.

    The post-meta.php file. See generate_post_meta function.

    A wise man once said:
    "Have you cleared your cache?"


    Here’s the foreach –

    <?php $latest_news = get_posts(array(
    'post_type' => 'post',
    'posts_per_page' => '3',
    )); ?>
    <section class="latest-news grid-container grid-parent">
    <div class="latest-news-grid three-column-grid">
    <?php foreach($latest_news as $post): setup_postdata($post); ?>
    <?php get_template_part( 'news', 'card'); ?>
    <?php endforeach; wp_reset_postdata(); ?>

    And this is what is in the news-card template part –

    <article id="post-<?php the_ID(); ?>" <?php post_class('grey-border'); ?> <?php generate_do_microdata( 'article' ); ?>>
    	<div class="inside-article padding-20">
    	<header class="entry-header">
    		<?php do_action( 'generate_before_entry_title'); ?>
    			<?php $params = generate_get_the_title_parameters();
    			the_title( $params['before'], $params['after'] ); ?>
    		<?php do_action( 'generate_after_entry_title' ); ?>
    	<?php do_action( 'generate_after_entry_header' );
    	$itemprop = '';
    		if ( 'microdata' === generate_get_schema_type() ) {
    		$itemprop = ' itemprop="text"';
    	<?php do_action( 'generate_after_entry_content' );
    	do_action( 'generate_after_content' ); ?>

    The news card template part is working in the loop on index.php but doesn’t show the post date, category, or read more on my custom homepage template.


    Sorry I had the wrong news-card code but have updated the above post

    Lead Developer
    Lead Developer

    Hi there,

    Just to confirm, is this a custom post type where you’ve set up a custom file structure, and now things like post meta etc.. aren’t being displayed?

    If so, these filters may help:


    Hi Tom,

    This isn’t a custom post type, just the standard WordPress posts. The entry and footer meta isn’t appearing on the homepage when I use the template part.

    Lead Developer
    Lead Developer

    Does this display anything?:

    add_action( 'generate_before_entry_title', function() {
        echo 'hello';
    } );
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.