[Resolved] Sections and Hooks issue

Home Forums Support [Resolved] Sections and Hooks issue

Home Forums Support Sections and Hooks issue

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #438662
    Alberto

    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!

    #438778
    Zesen

    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.

    #438819
    Leo
    Staff
    Customer Support

    Can you provide the full code you are using?

    and perhaps link us to the page in question?

    #439016
    Alberto

    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!

    #439072
    Leo
    Staff
    Customer Support

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

    #439116
    Alberto

    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.

    #439198
    Leo
    Staff
    Customer Support

    Can you try this for the sponsoren div?

    <div class="sponsoren grid-container">

    #439210
    Zesen

    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>';
    ?>
    #439413
    Alberto

    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

    #439447
    Leo
    Staff
    Customer Support

    Yup looks good to me!

    #439665
    Alberto

    Ok.
    Thank you!

    #439697
    Leo
    Staff
    Customer Support

    Glad we could help!

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.