当前位置:网站首页>How to Add Category-Specific Widgets in WordPress
How to Add Category-Specific Widgets in WordPress
2022-08-05 03:05:00 【IDC Industry Observer】
Widgets are definitely a highlight of WordPress.Unfortunately, many users use gadgets without really realizing their true potential, resulting in a cluttered sidebar or two, depending on your theme.
Luckily, there is a solution on your WordPress dashboard in the form of a JetPack module called Widget Visibility.
This little module alone lets you display certain widgets on certain articles or pages -- basically, it gives you fine-grained control over your widgets and where you want them to appear.

With this module activated, there is no limit to the number of "different" sidebars you can have.
You can display certain widgets on your homepage, a different set of widgets on your "About" or "Contact" pages, and a completely different set of widgets on your posts or specific categories.
Let's see how to do it!
Add a specific category of widgets in WordPress
The first thing you need to do is install the JetPack plugin, if you haven't already.
If Jetpack is already installed on your website, then you're ready to go.
First step:
The first thing you need to do is log into your dashboard, mouse over JetPack, and go to settings.
Scroll down until you see Widget Visibility.Click the module name, then click Activate.

Step 2:
Now that you've activated this module, let's see how to display widgets only for certain categories.
Let's say you want to display more articles from that category on an article in the same category.
The easiest way to do this is to first create an image for your category (something simple in Picmonkey will do) and upload the image to your media library.
Then grab the URL of the uploaded image.
Step 3:
Next, go to Appearance > Widgets and drag the Image widget to your sidebar.
Fill in the fields for Image URL and Image Size to ensure it displays correctly.In the "Link URL (when the image is clicked)" field, enter the link of your desired category.
Now, here comes the fun part!
Step 4:
Click the Visibility button and select Display.Change the desired gadget type from the drop-down menu.Then click Save.
The gadget will now only appear on posts belonging to the specified category.
Visibility is controlled by five areas: page type, category, tags, date, and author.
For example, if you want the author widget to only appear on posts by that author, select "Show" from the first drop-down menu and add two rules."The author is" and "The author you want".

Similarly, you can choose to hide certain widgets from certain pages.
Like the author widget example above, you can choose to hide it on your About page, as it really doesn't make sense to have it appear there.In this case, you can change the first option of "Show" to "Hide", then select "Page", and then select the corresponding static page from the final drop-down menu.
Each visibility rule is handled individually.For example, there's no way to only show widgets on posts that are categorized as "recipes" and tagged as "breakfast ideas."You can only choose one or the other.
From https://cn.bluehost.com/blog/wordpress/15915.html
边栏推荐
猜你喜欢

告白数字化转型时代,时速云镌刻价值新起点

The design idea of DMicro, the Go microservice development framework

Matlab画图3

Go 微服务开发框架 DMicro 的设计思路

Cloud Native (32) | Introduction to Platform Storage System in Kubernetes

In 2022, you still can't "low code"?Data science can also play with Low-Code!

Why did they choose to fall in love with AI?

Is your data safe in this hyperconnected world?

Step by step how to perform data risk assessment

数据增强Mixup原理与代码解读
随机推荐
In 2022, you still can't "low code"?Data science can also play with Low-Code!
rpc-remote procedure call demo
数学-求和符号的性质
Multithreading (2)
HDU 1114:Piggy-Bank ← 完全背包问题
STM32 uses stm32cubemx LL library series tutorial
Tencent Cloud [Hiflow] New Era Automation Tool
倒计时 2 天|云原生 Meetup 广州站,等你来!
引领数字医学高地,中山医院探索打造未来医院“新范式”
1484. Sell Products by Date
Turn: Charles Handy: Who you are is more important than what you do
post-study program
腾讯云【Hiflow】新时代自动化工具
sql server installation prompts that the username does not exist
Principle and Technology of Virtual Memory
Talking about data security governance and privacy computing
How OpenGL works
北斗三号短报文终端露天矿山高边坡监测方案
QT语言文件制作
【软件测试】自动化测试之unittest框架