[Resolved] WP_Widget and GP hooks

Home Forums Support [Resolved] WP_Widget and GP hooks

Home Forums Support WP_Widget and GP hooks

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #239365
    Thierry

    Hello,

    I want use a widget above the footer, on the codex i found this : https://codex.wordpress.org/Function_Reference/the_widget

    on my template (functions.php) i have this :

    // Set up our array of widgets
    	$widgets = array(
    		__( 'Right Sidebar', 'generatepress' ) => 'sidebar-1',
    		__( 'Left Sidebar', 'generatepress' ) => 'sidebar-2',
    		__( 'Header', 'generatepress' ) => 'header',
    		__( 'Footer Widget 1', 'generatepress' ) => 'footer-1',
    		__( 'Footer Widget 2', 'generatepress' ) => 'footer-2',
    		__( 'Footer Widget 3', 'generatepress' ) => 'footer-3',
    		__( 'Footer Widget 4', 'generatepress' ) => 'footer-4',
    		__( 'Footer Widget 5', 'generatepress' ) => 'footer-5'
    	);
    	

    On GP hooks, <?php the_widget(‘header’); ?> it’s not ok, what is the good code ?

    Thx

    #239409
    Tom
    Lead Developer
    Lead Developer

    Any reason you’re not just using the built in footer widgets?

    Ideally you would register a new widget area, and then implement it in the template – that’s a little advanced though.

    One thing you can try is this plugin: https://en-ca.wordpress.org/plugins/widget-shortcode/

    That will allow you to add widgets into GP Hooks.

    #239446
    Thierry

    in fact i want a “second” footer for all website, there is un best solution ?

    #239474
    Tom
    Lead Developer
    Lead Developer

    The plugin I suggested with GP Hooks is probably the best solution ๐Ÿ™‚

    #239575
    Thierry

    it’s good:)

    but just for understand with GP hooks this code

    <?php the_widget( 'WP_Widget_Pages' ); ?>
    work, only this list https://codex.wordpress.org/Function_Reference/the_widget works ? no “gp widgets” ?

    #239645
    Tom
    Lead Developer
    Lead Developer

    the_widget() displays individual widgets – not widget areas. GP doesn’t add any custom widgets.

    #239675
    Thierry

    thank you for your answers

    #239685
    Tom
    Lead Developer
    Lead Developer

    No problem ๐Ÿ™‚

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