- This topic has 11 replies, 3 voices, and was last updated 4 years, 5 months ago by Leo.
November 30, 2017 at 5:22 am #438662Alberto
I’m having the same issue as here (https://generatepress.com/forums/topic/afetr-content-hook-not-implemented-on-pages-using-sections/) so I’ve tried what you told but I’ve had two problems:
1) The shortcode is not rendering, so I only see [the shortcode…]
2) If I’m in a section page the html added in generate_after_main_content hook appears without paddings or margins, but in a non section page it appears with paddings or margins.
Any help, please?
Thanks in advance!GeneratePress 1.4GP Premium 1.5.5November 30, 2017 at 6:59 am #438778Zesen
If you see the text rendering out, kind of sounds like you are simply outputing them as HTML. Are you sure you are doing this?
<?php do_shortcode("[the short code]"); ?>
As for your second question, I personally don’t use Sections, but it sounds reasonable to me: if you are using sections for a page, and you are adding custom content to it via hook, you should be writing your markup for the added content as well.November 30, 2017 at 7:34 am #438819LeoStaffCustomer SupportNovember 30, 2017 at 11:49 am #439016Alberto
Zesen, you’re right! I was outputting as html so using the do_shortcode function do the trick.
Now I must adjust my div to looks like, for example, the Uw Bigdraje page.
Please, take a look at http://duitslanddag.sjbdixital.net/
Thanks in advance!November 30, 2017 at 1:18 pm #439072LeoStaffCustomer SupportNovember 30, 2017 at 2:21 pm #439116Alberto
I want to show the sponsoren div in all pages as it’s showed in Uw Bijdrage, Impressie and Aanmelden pages, not like it’s showed in Home, Programma, Sprekers, Standhouders and Niews pages.
I’ve used the sections add-on in this last ones (not in the other three pages).
What can I do to show all the pages in the same way?
Thanks.November 30, 2017 at 5:16 pm #439198LeoStaffCustomer SupportNovember 30, 2017 at 5:52 pm #439210Zesen
Just to elaborate a bit more on Leo’s response, if the
sponsorendiv is generated by the shortcode, then I guess you would need to wrap it inside like this:
<?php echo '<div class="container grid-container">'; do_shortcode("[the short code]"); echo '</div>'; ?>December 1, 2017 at 4:29 am #439413Alberto
Hi Leo and Zesen.
Mmmm almost right.
The only problem is in pages with sidebars: for example in Nieuws or in a single standhouder page.
So I’ve tried with generate_before_content hook and it seems to work fine.
Do you also think this is the best approach?
ThanksDecember 1, 2017 at 5:44 am #439447LeoStaffCustomer SupportDecember 1, 2017 at 11:13 am #439665Alberto
Thank you!December 1, 2017 at 12:18 pm #439697
- You must be logged in to reply to this topic.