Archived topic
WP_Widget and GP hooks
7 replies · Started by Thierry on October 27, 2016
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
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.
in fact i want a "second" footer for all website, there is un best solution ?
The plugin I suggested with GP Hooks is probably the best solution :)
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" ?
the_widget() displays individual widgets - not widget areas. GP doesn't add any custom widgets.
thank you for your answers
No problem :)