Site logo

Archived topic

Replace the widget of a specific page

6 replies · Started by Hilton on October 19, 2021

Viewing posts 1–7 of 7

Hi, I registered a new sidebar using the function below in functions.php:

function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'Recipes Filter',
'id' => 'recipes_filter',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<div class="widget-title">',
'after_title' => '</div>',
) );
}
add_action( 'widgets_init', 'arphabet_widgets_init' );

So far so good, the sidebar appears in the specific area of Wordpress. But now I would like to know how I can put this sidebar specifically on a page that has the url http://www.mysite.com/my-page

Thanks

ps. I don't want to use any plugin. Thanks ;)

Sounds good.

I would say that the plugin solution I recommended would work just as well without any custom coding - most of our users find the plugin very helpful and it should have minimal impact on your site performance if that's your concern.

If you need help modifying the existing solution then you can try commenting on the article you found.

I think certain occasional needs don't need plugins. If I want this for one page only, why will I install a plugin for this if I can solve it with a few lines of code. I'm always very concerned when it comes to code, less is more.

This archived topic is closed to new replies.