Archived topic
How can i display two short codes next to each other?
7 replies · Started by Daniel on July 10, 2020
Hello
I'm trying to display two shortcodes next to each other [wp_ulike] and [addtoany] right above the category tags : https://prnt.sc/tfqdou
I want this to display it on category pages, homage page and post page. How can I achieve this?
Thanks!
Hi there,
Try adding using a hook element:
https://docs.generatepress.com/article/hooks-element-overview/
The generate_after_content hook with priority 2 should do:
https://docs.generatepress.com/article/hooks-visual-guide/
Hello
Looks like it worked but how can I make them next to each other? https://prnt.sc/tg4vf4 , https://prnt.sc/tg4vq6
Can you do this in the HTML:
<div class="after-content-icons">
[shortcode 1]
[shortcode 2]
</div>
Then add this CSS:
.after-content-icons {
display: flex;
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
That worked but is there any way I can move the image (second shortcode) all the way to right side? https://prnt.sc/tgijs7
Try this as well:
.after-content-icons .addtoany_shortcode {
margin-left: auto;
}
Hi, I'm not using an the Element, but trying to use the copyright bar (enabled in GP Premium Settings). And I'd like to display my affiliate links for GP and Flywheel (my host) using this format:
© 2020 MATCHLESS WEB STUDIO, LLC | POWERED BY GeneratePress + Flywheel
But when using the short codes I registered, likely incorrectly (see PHP below), the output is this:
© 2020 MATCHLESS WEB STUDIO, LLC | POWERED BY +
Where the only link output is the GP affiliate Link and it's assigned to the "+" that should be in between the two links.
Is there something that could be cleaned up with the PHP below that would correct my error?
Or would it be better for me to scrap the copyright bar and use an Element to produce the effect I'm looking for?
My site is https://matchlessweb.com/ if you'd like to have a look at the copyright bar with this output:
function gp_affiliate_link() {
return '';
}
add_shortcode("GP", 'gp_affiliate_link');
function flywheel_affiliate_link() {
return '';
}
add_shortcode("Flywheel", 'flywheel_affiliate_link');
Please open a new topic for your question.
Thanks :)