wordpress侧边栏_如何在WordPress中为每个帖子和页面显示不同的侧边栏

本文介绍了如何在WordPress中为每个帖子和页面创建和显示不同的侧边栏。通过使用Easy Custom Sidebars插件,您可以轻松地定义自定义侧边栏,并根据特定的帖子或页面替换默认侧边栏,以显示不同的内容,如特色内容、邮件注册表单或广告。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

wordpress侧边栏

Do you want to display different sidebars for different posts and pages on your WordPress site? Typically, WordPress themes show the same sidebars on fixed locations regardless of which post or page you’re on. In this article, we will show you how to create and display different sidebars for each post and pages in WordPress.

您是否要在WordPress网站上为不同的帖子和页面显示不同的侧边栏? 通常,无论您在哪个帖子或页面上,WordPress主题都在固定位置显示相同的侧边栏。 在本文中,我们将向您展示如何为WordPress中的每个帖子和页面创建和显示不同的侧边栏。

Custom Sidebars for WordPress
什么时候需要WordPress中的其他侧边栏? (When Would You Need Different Sidebars in WordPress?)

By default, sidebars are defined by your WordPress theme. Each WordPress theme comes with a few sidebars or widget ready areas that allow you to add widgets.

默认情况下, 边栏由WordPress主题定义。 每个WordPress主题都带有一些补充工具栏或小部件就绪区域,可让您添加小部件

Typically a sidebar on the blog is displayed throughout your site on all posts, pages, categories, and archive pages. However, sometimes you may want your sidebar content to change based on specific posts or pages.

通常,博客的侧边栏会显示在整个网站的所有帖子,页面,类别和存档页面上。 但是,有时您可能希望侧边栏内容根据特定的帖子或页面进行更改。

For example, you can show different featured content in the sidebar of your most popular posts, add different email signup forms, or display ads.

例如,您可以在最受欢迎的帖子的侧边栏中显示不同的特色内容,添加不同的电子邮件注册表格或展示广告

Having said that, let’s see how to create and display different sidebar for each post and page in WordPress.

话虽如此,让我们看看如何为WordPress中的每个帖子和页面创建和显示不同的侧边栏。

影片教学 (Video Tutorial)

演示地址

If you don’t like the video or need more instructions, then continue reading.

如果您不喜欢该视频或需要更多说明,请继续阅读。

在WordPress中为每个帖子和页面显示不同的侧边栏 (Displaying Different Sidebars for Each Post and Page in WordPress)

First thing you need to do is install and activate the Easy Custom Sidebars plugin. For more details, see our step by step guide on how to install a WordPress plugin.

您需要做的第一件事是安装并激活Easy Custom Sidebars插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。

Upon activation, you need to visit the Appearance » Theme Sidebars page to create custom sidebars.

激活后,您需要访问外观»主题侧栏页面来创建自定义侧栏。

Creating a new custom sidebar

First you need to provide a name for your custom sidebar and then click on the create sidebar button.

首先,您需要为自定义边栏提供一个名称,然后单击“创建边栏”按钮。

The plugin will now create your sidebar, and you will be able to select the sidebar properties.

插件现在将创建您的侧边栏,您将能够选择侧边栏属性。

Sidebar settings

After that you need to select which theme sidebar will be replaced by your custom sidebar and provide a description for it.

之后,您需要选择将由自定义侧边栏替换的主题侧边栏,并为其提供描述。

Next, you need to select where you want your custom sidebar to replace the theme sidebar. You will see your posts, pages, categories and tags listed in the left column of the screen.

接下来,您需要选择您希望自定义边栏替换主题边栏的位置。 您将在屏幕的左列中看到您的帖子,页面,类别和标签。

Simply select the areas where you want custom sidebar to be displayed and then click on ‘Add to sidebar’ button.

只需选择要显示自定义侧边栏的区域,然后单击“添加到侧边栏”按钮。

Add posts or pages to your custom sidebar

You will notice your selected items appear under the custom sidebar settings. Don’t forget to click on the save button to store your sidebar settings.

您会注意到您选择的项目显示在自定义边栏设置下。 不要忘记单击保存按钮来存储侧边栏设置。

Easy Custom Sidebar allows you to create as many custom sidebars as you like and assign each sidebar to different pages on your WordPress site.

Easy Custom Sidebar允许您创建任意数量的自定义侧边栏,并将每个侧边栏分配到WordPress网站上的不同页面。

将小部件添加到自定义边栏 (Adding Widgets to Your Custom Sidebars)

Once you have created custom sidebars and assigned them to different areas of your website, it’s time to add widgets to your sidebars.

创建自定义边栏并将其分配到网站的不同区域之后,就可以将小部件添加到边栏中了。

Head over to the Appearance » Widgets page. You will notice your newly created custom sidebars among your theme’s default sidebars.

转到外观»小部件页面。 您会注意到主题的默认侧边栏中的新创建的自定义侧边。

Add widgets to custom sidebar

You can go ahead and add widgets to your custom sidebars. The plugin will now show the sidebars based on your settings. You can visit your selected pages to see it in action.

您可以继续并将小部件添加到自定义边栏中。 现在,该插件将根据您的设置显示侧边栏。 您可以访问选定的页面以查看实际操作。

We hope this article helped you learn how to add different sidebars to each post or page in WordPress. You may also want to see our these WordPress sidebar tricks to get maximum results.

我们希望本文能帮助您学习如何向WordPress中的每个帖子或页面添加不同的侧边栏。 您可能还想看看我们的这些WordPress侧边栏技巧,以获取最大的效果

翻译自: https://www.wpbeginner.com/wp-themes/display-different-sidebar-for-each-post-and-page-for-wordpress/

wordpress侧边栏

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值