WordPress defines different pages and calls different sidebar templates

A customer website of the company needs to use different calling contents for different page sidebars of WordPress program. In fact, we can also use widget logic plugin to define the display range of a floating module, but we are not free to define it. So I’m going to use a separate template file to embed the call.

Contents of articleshideFirst, copy sidebar2.php, a separate sidebarSecond, modify the call fileFirst, copy sidebar2.php, a separate sidebar

We will define the sidebar that needs to be defined separately as sidebar2. PHP file, which we need to use later.

Second, modify the call file

We will add the sidebar code in a page:

<?php get_ sidebar(); ?>

To be amended as follows:

<?php include_ once(“sidebar2.php”); ?>

After the modification, we refresh and clean up the cache, and we can see that the sidebar defines the problem separately.

Related Article
WordPress automatically intercepts part of the content of the article as a summary

In the daily release of articles, not every article may have an article summary, so the summary function of WordPress Read more

Implementation of tag inner chain association effect of WordPress program without plug-in

Nowadays, whether it is a large website or a personal blog, what matters is not the weight of the website Read more

Is in WordPress Theme_ Home () and is_ front_ Different usage of page ()

Under normal circumstances, when we use WordPress to build a website, the home page is the default index.php Just call Read more

How to delete the version number tail of WordPress scripts and CSS style sheets

As an excellent website building program, WordPress is undoubtedly the largest user group in the world in terms of user Read more

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image