- This topic has 7 replies, 3 voices, and was last updated 3 years, 5 months ago by Tom.
November 27, 2017 at 5:56 am #435596Alvaro
I have inserted an Elementor widget after the content on ‘posts’ (a social share buttons type) via GP Hooks adding:
<?php endif; ?><?php if ( is_single() ) : ?> [elementor-template id="4315"] <?php endif; ?>
I have also installed a third party ‘Related posts’ widget, whch automatically places itself in 1st position ‘after the content’ on posts.
I would like to be able to choose the order I want to place all these widgets (I will add a third widget) but can’t figure out how to do it on GP Hooks.
AlGP Premium 1.5.5November 27, 2017 at 8:05 am #435790LeoStaffCustomer SupportNovember 27, 2017 at 8:45 am #435852Alvaro
The ‘related posts’ widget is added automatically, no need to do anything. On the other hand, I added an Elementor widget manually on GP hooks at the end of the posts as well.
I haven’t included the related posts widget on GP hooks code myself and therefore I can’t control in which order I wish them to appear. It appears ‘related posts’ first, but I wanted to see my ‘Elementor’ widget first. Is it anything I could do? The only code I have included so far is as per above.
AlNovember 27, 2017 at 12:05 pm #436133LeoStaffCustomer SupportNovember 27, 2017 at 2:22 pm #436296Alvaro
GeneratePress does not have an ‘after the post’ widget area in which I can drag in any widget to that area from WordPress Dashboard.
Therefore, I am adding my own widget made on Elementor manually through GP Hooks on ‘After Content’.
It displays ‘Social Media buttons’ succesfully:
Afterwards, I wanted to have an additional widget to let me display ‘Related posts’. I downloaded a third party widget. Once installed, it is automatically placed after the post with no manual intervention. That means, the code on ‘After Content’ GP Hooks remains the same as before when I only had ‘Social Media buttons’, but I now have two widgets.
My aim is to keep both widgets in this place, but I wanted to have them in opposite order. First ‘Social Media’, then ‘Related posts’. If I had both codes, I would just have to copy first one code and then the other. As I only have included manually the ‘Social Media widget’ code, I cannot change the order, nor I don’t know where to get the other code or how to modify it (if possible).
My question is:
is there any way I can change the order of the widgets by just writing some code on GP Hooks? How can I do it? As you can see, I’m not an expert and this is turning quite complicated for me.November 27, 2017 at 11:06 pm #436651TomLead DeveloperLead Developer
Plugins which filter into the content like the related posts plugin make it very difficult to control the order unfortunately.
Does that plugin allow you to disable the automatic placement, and manually place their code? That would be the best way around it.
Otherwise you’ll need to filter the_content, which is no fun.November 28, 2017 at 12:26 am #436704Alvaro
Thanks Tom. That sounds like bad news.
Unfortunately, it does not allow automatic placement. It lets you add some CSS, not sure if we can work around there?
I’m all ears for any alternative you might think, it was difficult to find a suitable plugin!November 28, 2017 at 9:02 am #437072TomLead DeveloperLead Developer
It might be worth asking the developer – there’s usually a workaround to disable automatic placement, and then manually place it with a function.
I try to avoid filtering the_content, as it can cause bugs elsewhere.
- You must be logged in to reply to this topic.