Site logo

Archived topic

Sections and Hooks issue

11 replies · Started by Alberto on November 30, 2017

Viewing posts 1–12 of 12

Hello.
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!

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.

Can you provide the full code you are using?

and perhaps link us to the page in question?

Hello.
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/

Any thoughts?

Thanks in advance!

Not sure what you mean? What am I looking at?

Hi Leo.
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.

Can you try this for the sponsoren div?

<div class="sponsoren grid-container">

Just to elaborate a bit more on Leo's response, if the sponsoren div 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>';
?>

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?

Thanks

Yup looks good to me!

Ok.
Thank you!

Glad we could help!

This archived topic is closed to new replies.