Create a custom category for the Department of the company site

I often ask whether WordPress multisite is suitable for the company website where other departments with unique ID are located. The answer is usually: Multisite can do this. However, even if you use multiple sites, you don’t always have to create separate sites for each department of your company’s website. If you want to include non unique shared content on each device, or if the device ID has many things in common, or if you use an existing single site installation, you can solve this problem without activating multiple sites. The
This post will show you how to use a custom taxonomy. You can create a split category for posts and pages, specifying a site section that must contain each post or page. You can then create a template file for the classification and display the contents of each department as needed. Although you need to create plug-ins and files in the theme and write code, the code is not difficult. I will use sub themes of the 26 basic themes, but I can use this technique with my own theme. We will create a plug-in to register the custom taxonomy. It is recommended that you use the plug-in to do this in order to avoid losing the taxonomy when you change the topic later. The
Here we go! Before you begin, you need to: If there is an existing company website, copy my WordPress development or test installation. Do not perform this operation on a live site. After all operations are completed, you can upload files in real time at any time. Code editor. Theme – it can be your own theme, or it can be a 26 year old child as I use it. Even if you use subtopics, you must ensure that 26 are installed. First create a sub topic and activate it. You can read the post of the sub topic, so it won’t explain how to do this in detail, but here is the code of the style sheet in the sub topic. The
The loading summary fb5c19719547f6134cef15ffc176e8a7 shows that it has been uploaded to GitHub. You can the file of this post from this code. A demo site has also been created. Now activate the subtopic on the site. This has the same effect as activating 26. The next step of classification registration is to create a plug-in and register the taxonomy. You may want to add the code to the function file of the topic, but the problem is that if you change the topic later, you will lose the classification system, and you can access all the terms created for the topic. In the text Printer Manager
Create a new file in the plug-in folder (located in WP content) and specify the appropriate name. Open it in the comments below to tell us what word press is. Load summary 3586769d59f025d32bb9ec1a63dc1671 now add the function to register the classification. Load the abstract 852e2e51e713caaf555e802a1849b914. In this way, a classification named distinction will be registered and relevant labels will be generated, including name, menu name, etc. It also specifies that the array (\
Now activate the plug-in on the site. When editing posts and pages, you can access the new category. Now you can create taxonomic terms for various departments of your company and assign them to posts and pages. The Department display on the site has now created stacked content and distinguished it from my posts and pages. The following is part of my post: I also created several pages about my department and more general pages. You can now add all pages and departments to the default navigation menu of the website
Do not add a post because it will appear on the archive page. This operation was performed in the menu management screen. The
Male WordPress will automatically generate an archive page for each department, and use the topic template hierarchy to display the page in the topic using the best template file. The \
To correctly display the classified archive page, please use taxonomy division. You must create a theme template file named PHP. Let’s copy and edit the existing template file. Archive to topic. If you have a PHP file, copy it, and then taxonomy division. Called PHP. If there is no archived template file, use index. Please make a copy of PHP. Because I am working on 26 Themes, I archive them in 26 of my children’s themes. Create a copy of the PHP file and use taxonomy division. Called PHP. The
First, edit the comments at the beginning of the file to more accurately show the purpose of the file. Load summary f365378231dde7344d5802a9a18877 now find the code for the loop. Display from 26 copied my files: Load summary 9d41a80ea7bab2185aa33714ea1fa5c2 this is the content. Call 26 template parts called PHP. We will maintain it, but we will run it twice. Once for publishing and once for pages. Edit the loop of the template file so that it reads: The
Loading the summary 595e896b1fd37b85d6333ff639e327c5 loop runs twice, but queries the database only once, which is more efficient than using wp_query to create a completely new query. Check whether the current post is a \
You can specify the style of separation in your own way, and here you will want to do more than I did. But now, in order to make pages, posts and look slightly different, each department’s archive page. Do this in the style sheet of the sub theme (or in the theme style sheet if you do not use a sub theme). Open the style sheet and add the following styles: Load summary 25127f522b0bab43902222863934fd5 based on the classification terms I use, add the style of the archive page title for the classes applied to the body element. You must edit with a unique taxonomy term. On the classified archive page of the site, you can check the HTML output and the body element to find the generated classes. Now, yellow has been added to my r&d classification system archive and distinguished. Male can also be added here. You can specify styles for posts on the default blog page of other departments, or for other elements on the archive page or on the page of a single post. In addition, the link star in the default navigation menu

Author:

Leave a Reply

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