-
Hello, Im trying to move the upper AddToAny location after the “Created By: Webmaster”
before the icons, i want to add text: Share Now:
-
Fernando
Hi there,
Do those Share Buttons have a
Shortcode
to make it appear?If it does, you can create a Block Element – Post Meta Template and add a Shortcode Block for the Share Buttons.
Reference: https://docs.generatepress.com/article/block-element-post-meta-template/
-
EDIT:
I saw the youtube guide, When I go to create new block element i dont have the “Block Element” to choose.
in the plugin itself you just select where you want it to appear and it just appear there.
just found the shortcode: [addtoany]
im trying to follow your links to make it work.
-
Fernando
Alright. Let us know how it goes.
-
I saw the youtube guide, When I go to create new block element i dont have the “Block Element” to choose “Post Meta Template”
FYI: I Disabled gutenberg, idk if its the reason.
-
Fernando
You’re correct.
You need to use the default WordPress Block Editor to use the Block Element feature of GP Premium.
In any case, can you try adding a filter like this as an alternative?:
add_filter( 'generate_post_author_output', function( $output ) { return do_shortcode('[addtoany]') . ' ' . '<span class="coauthor"> and <a href="' . $coauthor_link . '">' . $coauthor . '</a></span>'; } );
Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
-
gigasb
Your support already helped with the next code snippet:
add_filter( 'generate_post_date_output', function( $output, $time_string ) { $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished"><strong>נוצר בתאריך:</strong> %2$s</time>'; if ( get_the_date() !== get_the_modified_date() ) { $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished"><strong>נוצר בתאריך:</strong> %2$s, </time><time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified"><strong>עודכן בתאריך:</strong> %4$s</time>'; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); return sprintf( '<span class="posted-on">%s</span> ', $time_string ); }, 10, 2 );
so I guess both codes, need to be combined now, can you please help me with that?
-
Hi there,
the two codes should not need combining.
Have you tried added Fernandos code ? -
gigasb
its not working:
i like the codes u gave me for updated and created article date, i would like to keep it, only add the shortcode.
I replaced the code to the last one mentioned since its not good (until u reply) -
The code that Fernando provided can you change that to:
add_filter( 'generate_post_author_output', function( $output ) { return $output . do_shortcode('[addtoany]'); } );
-
gigasb
The result is:
I want to keep the Created on & Updated on titles (with the bold code)
if you will see the code you guys gave me last time, i just want to add the [addtoany] code after the Created By: Webmaster, and to keep it inline.There is a way to add the code on the code i pasted earlier ?
-
I am not seeing any change ? Is the last code i provided still on the site ?
-
gigasb
yes, the last one is active, i cleared css maybe refresh
-
Try adding this CSS now;
.single .entry-meta { display: flex; column-gap: 10px }
-
gigasb
Ok you can check the post now, its inline, I Enabled the last code & the new code (u can refresh the post)
Last problem I have, is that on mobile its not looks good, I need to make a <br> to the AddToAny code, ONLY if the user using a MOBILE phone
-
Fernando
Try adding this CSS as well:
@media (max-width: 768px){ .single .entry-meta { flex-wrap: wrap; } }
- You must be logged in to reply to this topic.