- This topic has 16 replies, 4 voices, and was last updated 5 months, 3 weeks ago by
Leo.
-
AuthorPosts
-
September 28, 2022 at 5:22 pm #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.September 28, 2022 at 6:11 pm #2357031Fernando 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
September 28, 2022 at 6:36 pm #2357036Jesus
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.September 28, 2022 at 7:22 pm #2357069Fernando 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?
September 28, 2022 at 7:38 pm #2357072Jesus
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.September 28, 2022 at 7:43 pm #2357073Fernando 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
itemprop
though in the Custom Attribute field in the Advanced section of the Block Settings.September 29, 2022 at 7:10 am #2357629Jesus
What is the hock name so that it appears after the featured image?
September 29, 2022 at 7:23 am #2357643Jesus
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.
September 30, 2022 at 1:30 am #2358507Fernando 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
orafter_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 ); } } );
September 30, 2022 at 1:08 pm #2359258Jesus
Hello
It works, but it still shows in the code of pages:<div class="entry-meta"></div>
Thanks.
September 30, 2022 at 3:51 pm #2359331Ying
StaffCustomer SupportDo you mean this part?
[screenshot removed]Yes, it’s added in by your code:
add_action( 'generate_after_entry_header', 'generate_post_meta', 15 );
September 30, 2022 at 5:33 pm #2359367Jesus
Please delete this capture. It has my information personal. 🙁
September 30, 2022 at 5:35 pm #2359368Jesus
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
September 30, 2022 at 5:39 pm #2359369Jesus
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
September 30, 2022 at 7:54 pm #2359394Leo
StaffCustomer SupportScreenshot removed. Sorry about that!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.