[Resolved] Problem entry-header in page hero

Home Forums Support [Resolved] Problem entry-header in page hero

Home Forums Support Problem entry-header in page hero

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #2357007
    Jesus

    Hello,
    I have created a hero page with generateblocks but I am facing the following problems:

    I needed the author and date under the featured image and not under the title.

    With page hero this is possible, but it does not respect the correct markup structure.

    If the block page hero is not used, the structure is as follows:

    <header class="entry-header" aria-label="Contenido">
    				<h1 class="entry-title" itemprop="headline">Example title</h1>			</header>

    When I use the page hero block, the structure changes to the following, with the itemprop=headline markup disappearing and the entry-meta header dislodged.

    <header class="entry-header" aria-label="Contenido">
    						<div class="entry-meta">
    			<span class="posted-on"><time class="entry-date published" datetime="2022-09-14T21:38:48+00:00" itemprop="datePublished">14 de septiembre de 2022</time></span> <span class="byline">por <span class="author vcard" itemprop="author" itemtype="https://schema.org/Person" itemscope=""><a class="url fn n" href="URL" title="Ver todas las entradas de Autor" rel="author" itemprop="url"><span class="author-name" itemprop="name">Nombe autor</span></a></span></span> 		</div>
    					</header>

    I send the website and data privately.

    On the other hand when I create a block for author and publication date in generateblocks the author and date markup is non-existent.
    Please, could you help me to solve these problems? Thanks.

    #2357031
    Fernando
    Customer Support

    Hi Jesus,

    If you don’t use a Page Hero, you can go to Appearance > Customize > Layout > Blog > Featured Imaged > Posts, and set the Location to Below Title.

    Then, add this PHP snippet:

    add_action( 'wp', function() {
        remove_action( 'generate_after_entry_title', 'generate_post_meta' );
        add_action( 'generate_after_entry_header', 'generate_post_meta', 15 );
    } );

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    #2357036
    Jesus

    Thanks, solved that the author appears below the featured image, but something so that the inter-meta appears with his image, author and social networks?

    It is only possible with a block?
    In the block there is no item markup.

    #2357069
    Fernando
    Customer Support

    I’m not sure I understand. Can you expound a bit more or provide an example of what you’re trying to achieve?

    #2357072
    Jesus

    Now I have managed to get the author and the date to appear below the featured image, but how do I make it look something like this?

    https://copyblogger.com/stepping-down/

    Not for share buttons, but with my social networks. Any code to put in the functions?

    I don’t want to use content block because it doesn’t mark the itemprompts, rel=”author” etc.
    Thank you.

    #2357073
    Fernando
    Customer Support

    I see. You can use a Block Element – Post Meta. Then, we can use a filter to add the rel="author" attribute. Just add a class to the Block through the advanced settings, and we’ll proceed from there.

    You should be able to add itempropthough in the Custom Attribute field in the Advanced section of the Block Settings.

    #2357629
    Jesus

    What is the hock name so that it appears after the featured image?

    #2357643
    Jesus

    add_action( ‘wp’, function() {
    remove_action( ‘generate_after_entry_title’, ‘generate_post_meta’ );
    add_action( ‘generate_after_entry_header’, ‘generate_post_meta’, 15 );
    } );

    Please how remove the post meta in pages and archives? I want only in single posts.

    Thanks for all.

    #2358507
    Fernando
    Customer Support

    Here’s a Hook Visual Guide you may refer to: https://docs.generatepress.com/article/hooks-visual-guide/#single-post

    You can try after_entry_header or after_entry_title. Try changing the value of the Hook Priority as well.

    As for the code, try changing it to this:

    add_action( 'wp', function() {
    if( is_single() ){
        remove_action( 'generate_after_entry_title', 'generate_post_meta' );
        add_action( 'generate_after_entry_header', 'generate_post_meta', 15 );
    }
    } );
    #2359258
    Jesus

    Hello
    It works, but it still shows in the code of pages:

    <div class="entry-meta"></div>

    Thanks.

    #2359331
    Ying
    Staff
    Customer Support

    Do you mean this part?
    [screenshot removed]

    Yes, it’s added in by your code:
    add_action( 'generate_after_entry_header', 'generate_post_meta', 15 );

    #2359367
    Jesus

    Please delete this capture. It has my information personal. 🙁

    #2359368
    Jesus

    I don’t understand how if you pass on password-protected information privately, you can make that capture public with my name, test domain… etc. Very bad of you. Deleted now please

    #2359369
    Jesus

    I don’t understand how if you pass on password-protected information privately, you can make that capture public with my name, test domain… etc. Very bad of you. Deleted now please

    #2359394
    Leo
    Staff
    Customer Support

    Screenshot removed. Sorry about that!

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