This article will explore some of the most worrying drug trends in the US today, providing important insights into the various different types of drugs that are causing health epidemics in America right now. See...
Relationships are easy to break and hard to mend. Over time you might find it difficult to cope with a person, and thus, you might lose contact with them. Or maybe the circumstances and obstacles...
Retail is a tricky business. You can’t turn a profit if you don’t have enough foot traffic, and for this, stores need a website that people will notice. If you’re planning to introduce your online...
What Exactly Is Real Estate Marketing Real estate marketing is a marketing technique that includes publicizing your unique value proposition to build a brand, acquire clients, and improve sales and income through concluding real estate...
Do you want to show different navigation menu items for different pages in WordPress? Or display a different menu for logged in users?
WordPress allows you to show a navigation menu in a specific location in your theme, but by default, it will always show the same menu.
In this article, we will show you how to add conditional logic to menus in WordPress.
Why Add Conditional Logic to Menus in WordPress?
Navigation menus give your WordPress website structure and help visitors find what they’re looking for. By default, your WordPress website will display the same navigation menu to all users and on all posts and pages.
However, there may be times when you wish to display different menus to different users, or on different pages on your website.
Using conditional logic, you could add extra menu items for logged in users so they can manage their accounts, renew their subscriptions, or view the online courses they purchased. You can think of it as WordPress menu access control.
With that being said, let’s take a look at how to add conditional logic to menus in WordPress. Here are the topics we’ll cover in this tutorial:
The first step is to create the additional navigation menus you wish to display in WordPress. After that, you can use conditional logic to decide when each menu will be displayed.
Simply head over to the Appearance » Menus page in the WordPress dashboard. If you already have a navigation menu that you use on your website for all users, then this can be your default menu.
Next, you need to click the ‘create a new menu’ link to create a new menu. For example, you could create one menu to show to logged in users, and another to display on a certain WordPress page or category.
On the left-hand side of the screen, you can see a list of your website pages. Simply check the box next to any page you want to add to your menu and click the ‘Add to Menu’ button.
You can also drag and drop the menu items on the right side of the screen to rearrange them.
Further down the page, you can choose a location to display your menu. But, you don’t need to assign a location to this menu now. We’ll do that in the next step.
Don’t forget to click on the ‘Save Menu’ button to store your changes.
Upon activation, you need to visit the Appearance » Menus page and switch to the ‘Manage Locations’ tab.
From here, you will see the list of available menu locations and the menus that are currently displayed. These will vary depending on the WordPress theme you are using.
For example, on our demo website, it is showing that our Primary Menu location is showing a navigation menu titled ‘Main Menu’.
We can tell the plugin to show a different menu when a certain condition is matched by clicking on the ‘+ Conditional Menu’ link and selecting another menu from the drop down menu. For this tutorial, we’ll select ‘Logged in Menu’.
Next, you need to click on the ‘+ Conditions’ link.
This will bring up a popup where you’ll see a bunch of conditions to choose from.
Simply check the box next to the ‘User logged in’ option, and then click on the ‘Save’ button.
You can now visit your website to see the logged in user menu in action. You can log out of your website to see the navigation menu that is shown to all other users.
Showing a Different WordPress Menu Depending on User Role
Once a user has logged in, you can also display a different navigation menu depending on the user role you have assigned to them.
For example, you could include extra menu items for an administrator and more limited items for a contributor. Or on a membership site, you could grant different levels of access to different membership levels.
As in the previous section, you need to install and activate the Conditional Menus plugin, then visit the Appearance » Menus page and switch to the ‘Manage Locations’ tab.
You should add the appropriate conditional menu for the user role you will select. For this tutorial, we’ve selected the ‘Nav Menu Administrator’ menu.
After that, you need to click the ‘+ Conditions’ link so you can choose the user role.
You will need to click on the ‘User Roles’ tab to see checkboxes for each user role on your website. Simply click the user roles that will see this menu, and then click the ‘Save’ button.
Showing a Different Menu for Different Pages in WordPress
You can display a different menu for different pages in WordPress. For example, you could display extra menu items on your privacy policy page, such as a link to your cookie notice.
To do this, you need to install and activate the Conditional Menus plugin, as shown above, then choose the appropriate navigation menu and click the ‘+ Conditions’ link.
This time you should click the ‘Pages’ tab. You will see a list of every page on your website.
You need to place a checkmark next to each page where you wish to display the navigation menu, then click the ‘Save’ button.
Hiding the Navigation Menu on Landing Pages in WordPress
There may be pages on your website where you don’t want to display a navigation menu at all, such as your landing pages.
A landing page is designed to increase sales or generate leads for a business. On these pages, you will want to minimize distractions and provide users with all the information they need to take a specific action.
You can do that using the Conditional Menus plugin. When selecting the conditional menu, this time you need to choose ‘Disable Menu’ from the drop down menu.
Next, you need to click the ‘+ Conditions’ link to choose when to display the menu.
You should click on the ‘Pages’ tab and place checkmarks next to your landing pages.
Don’t forget to click the ‘Save’ button to store your settings.
Doing More With WordPress Navigation Menus
Navigation menus are a powerful web design tool. They allow you to point users to the most important sections of your website.
Now that you are showing different navigation menus on different pages and for different users, you may be wondering how you can customize them further.
Try these useful tutorials to extend the functionality of the navigation menus on your WordPress website.
To build a brokerage brand that attracts customers and agents, you must first understand what each group is looking for. Customers are typically looking for low fees, convenience, and customer service. Agents are often attracted...
How can you take your jewelry business to the next level? One of the best ways to do this is by having an appealing website that easily sells your products and proves your knowledge in...
Do you want to display taxonomy images or category icons in WordPress?
By default, WordPress does not come with an option to upload a taxonomy image or category icon. It simply just displays a category or taxonomy name on the archive pages.
In this article, we’ll show you how to easily add taxonomy images or category icons in WordPress. We’ll also show you how to display taxonomy images on your archive pages.
Why Add Taxonomy Images in WordPress?
By default, your WordPress website does not come with an option to add images for your taxonomies like categories and tags (or any other custom taxonomy).
It simply uses taxonomy names everywhere including the category archives or taxonomy archive pages.
This looks kind of plain and boring.
If you get a lot of search traffic to your taxonomy pages, then you may want to make them look more engaging.
The easiest way to make a page more interesting is by adding images. You can add taxonomy images or category icons to make these pages more user-friendly and engaging.
A good example of it is a site like NerdWallet that uses category icons in their header:
You can also use it create beautiful navigational sections on your homepage like Bankrate:
That being said, let’s take a look at how to easily add taxonomy images in WordPress.
Upon activation, you can simply go to the Posts » Categories page. You’ll notice the plugin will be showing a placeholder image for your existing categories.
To choose your own category icon, you need to click on the Edit link below a category.
On the Edit category page, scroll down to the bottom and you’ll find a form to upload your own taxonomy image.
Simply click on the ‘Upload/Add New Image’ button to upload the image you want to use for that particular category.
Don’t forget to click on the Add Category or Update button to save your changes.
Next, you can repeat the process to upload images for other category images. You can also upload images for your tags and any other taxonomies as well.
Now the problem is that after adding the images, if you visit a category page, then you won’t see your category image there.
To display it, you will need to edit your WordPress theme or child theme. If this is your first time editing WordPress files, then you may want to see our guide on how to copy and paste code in WordPress.
First, you will need to connect to your WordPress site using an FTP client or your WordPress hosting file manager.
Once connected, you will need to find the template responsible for displaying your taxonomy archives. This could be archives.php, category.php, tag.php, or taxonomy.php files.
Once you have found the file, you’ll need to download it to your computer and open in a text editor like Notepad or TextEdit.
Now paste the following code where you want to display your taxonomy image. Usually, you would want to add it before the taxonomy title or the_archive_title() tag.
Depending on your theme, you may also need to style surrounding elements like taxonomy title and description.
We simply wrapped our taxonomy archive title and description in a <div> element and added a custom CSS class. We then used the following CSS code to adjust title and description.
Do you want to add an old post notification in WordPress?
If you have been producing content for some time now, then there is a chance that some of your content may be outdated.
In this article, we’ll show you how to easily add old post notification to your WordPress blog.
Why Add Old Post Notification to WordPress Blog Posts
Content decay (outdated blog posts) can be a bit of a problem for a growing WordPress blogs.
Depending on your niche, sometimes your content may become irrelevant, incorrect, or inappropriate over a period of time. This may cause a bad user experience, a higher bounce rate, and lower search rankings.
Ideally, you would want to edit those articles and update them with more useful, accurate, and up-to-date information.
But that’s not always possible because your site may have too many old articles, and you may not have enough resources to update them. In that case, adding an old post notification may be helpful for your users.
It will let them know that the content is a bit older, and they should keep this in mind when using the information presented on that page.
Another solution that many blogs use is by simply adding the ‘Last updated date’ instead of the publishing date.
That being said, let’s take a look at how you can add the old post notification in WordPress, and how to display the last updated date on your articles.
Upon activation, you need to visit the Settings » Out of Date page to configure plugin settings.
Here, you need to choose the period and duration. This is the time after which a post will be considered old by the plugin.
Below that you can provide a custom message to display on older posts and enable the notification to be displayed for all old posts. Don’t worry, you’ll be able to hide it for specific posts by editing them.
On the settings page, you can also choose post types, colors for the notification box, and add custom CSS if needed.
Don’t forget to click on the Save Changes button to store your settings.
You can now visit an old post on your website to see the plugin in action.
Hiding Old Post Notification on Individual Posts
Now let’s say you have an article that is older, but it is still accurate, up-to-date, and has great search rankings. You may want to hide the old post notification there.
Similarly, what if you have updated an old post with new information. The plugin will keep showing old post notification because it uses the post’s published date to determine its age.
To fix this, you can edit the post and scroll down to the ‘Out of Date Notification’ tab under the Post panel of the block editor. From here, simply uncheck the notification option and save your changes.
The plugin will now stop showing old post notification on this particular article.
Method 2. Display Last Modified Date for Your Posts
A lot of WordPress websites display the last modified date for their blog posts. Some replace the publish date with the last modified date as well.
The advantage of this method is that it shows users when a post was last updated without showing an old post message.
Upon activation, head over to Settings » WP Last Modified Info page to configure plugin settings.
On the settings page, you need to turn on the Global display of the last modified info toggle. After that, you can choose how you want to display the modified date.
You can replace the published date, show it before or after the content, or manually insert it into a post.
Below that, you’ll find a bunch of options. If you are unsure, then you can leave them to default.
Don’t forget to click on the Save Settings button to store your changes.
You can now visit your website to see the last updated information for all your blog posts.
This problem with this method is that it will show the last updated date for all posts including the newer posts.
You can set a time gap under plugin settings. But this gap is only limited to 30 days.
The plugin also provides three blocks that you can manually insert into a post or page to display last modified info.
You also have the option to use custom CSS to style your last updated date notice. We used the following custom CSS in the screenshots above.
This method requires you to manually add code to your WordPress theme files. If you haven’t done this before, then take a look at our guide on how to add custom code snippets in WordPress.
Simply copy and paste the following code in your theme’s single.php template.
// Define old post duration to one year
$time_defined_as_old = 60*60*24*365;
// Check to see if a post is older than a year
if((date('U')-get_the_time('U')) > $time_defined_as_old) {
$lastmodified = get_the_modified_time('U');
$posted = get_the_time('U');
//check if the post was updated after being published
if ($lastmodified > $posted) {
// Display last updated notice
echo '<p class="old-article-notice">This article was last updated ' . human_time_diff($lastmodified,current_time('U')) . ' ago</p>';
} else {
// Display last published notice
echo '<p class="old-article-notice">This article was published ' . human_time_diff($posted,current_time( 'U' )). 'ago</p>';
}
}
This code defines old posts to be any articles published at least one year ago.
After that, it checks if a post is older than a year. If it is, then it checks if the post was updated after publication. Then it displays a notice based on those checks.
Here is how it looked on our demo website for post that is old and was never updated.
Here is how it looked for a post that is old, but it was updated after being published.
We customized the old post notification with the following custom CSS.
If you want to put out conventional or digital media, you need to have a striking logo. Designing a logo might seem pretty straightforward, but the biggest companies will spend literally millions getting it right....
Do you want to disable directory browsing in WordPress?
Directory browsing can put your site at risk by showing important information to hackers which can be used to exploit vulnerabilities in your site’s plugins, themes, or even your hosting server.
In this article, we will show you how you can disable directory browsing in WordPress.
What Does Disabling Directory Browsing in WordPress Do?
Every time someone visits your website, your web server will process that request.
Usually, the server delivers an index file to the visitor’s browser, such as index.html. However, if the server can’t find an index file, then it may show all the files and folders in the requested directory instead.
This is directory browsing, and it’s often enabled by default.
If you’ve ever visited a site and seen a list of files and folders instead of a webpage, then you’ve seen directory browsing in action.
The problem is that hackers can use directory browsing to see the files that make up your website, including all the themes and plugins that you’re using.
If any of these themes or plugins have known vulnerabilities, then hackers can use this knowledge to take control of your WordPress blog or website, steal your data, or perform other actions.
Attackers may also use directory browsing to look at the confidential information inside your files and folders. They might even copy your website’s contents, including content that you would usually charge for such as ebook downloads or online courses.
This is why it’s considered a best practice to disable directory browsing in WordPress.
How to Check is Directory Browsing is Enabled in WordPress
The easiest way to check whether directory browsing is currently enabled for your WordPress website is by simply visiting the /wp-includes/ folder link like this: https://example.com/wp-includes/.
You’ll want to replace www.example.com with your website’s URL.
If you get a 403 Forbidden or similar message, then directory browsing is already disabled on your WordPress website.
If you see a list of files and folders instead, then this means that directory browsing is enabled for your website.
Since this makes your website more vulnerable to attack, you’ll typically want to block directory browsing in WordPress.
How to Disable Directory Browsing in WordPress
To disable directory listing, you’ll need to add some code to your site’s .htaccess file.
To access the file, you’ll need an FTP client, or you can use the file manager app inside your WordPress hosting control panel.
After connecting to your site, simply open your website’s ‘public’ folder and find the .htaccess file. You can edit the .htaccess file by downloading it to your desktop and then opening it in a text editor like Notepad.
At the very bottom of the file, simply add the following code:
Options -Indexes
It will look something like this:
Once you’re done, save your .htaccess file and upload it back to your server using an FTP client.
That’s it. Now if you visit the same http://example.com/wp-includes/ URL, you’ll get a 403 Forbidden or similar message.
Are you a startup company owner who is facing problems to manage the data of your business? Here is the reason behind this problem. When you started your business, you were not aware of the...
What are Permalinks? Permalinks, a term for “Permanent Links,” are the URLs used in WordPress to access single pages, posts, and archives on your website. For example, permalinks of a…
In an outbound call center setting, an auto dialer is one of the preferred auto-calling systems. However, in the past, a call center only used an auto dialer to contact people from an established list...
Do you want to add an author’s photo in WordPress?
By default, most WordPress themes show the author’s gravatar as their profile picture. However, authors may want to replace this gravatar with another image.
In this article, we will show you how to add an author’s photo in WordPress.
When Do You Need to Add an Author’s Photo in WordPress?
If you run a multi-author WordPress site, then you may decide to add an author info box in WordPress posts. These author bio boxes typically show the author’s profile photo, a brief bio, and link to their website or social profiles.
By default, most WordPress themes use the person’s gravatar as their author photo. However, sometimes you may prefer to use a different image for the author photo.
As a WordPress website owner you may even have rules about the kind of photos you want to show in your author bio boxes. For example, maybe you require your authors to use a professional headshot.
If the author’s gravatar doesn’t meet your rules, then you may want to edit their profile and upload an image that better suits your WordPress blog.
With that in mind, let’s see how you can add an author’s photo in WordPress.
How to Add an Author’s Photo in WordPress
The easiest way to add an author photo in WordPress is by using the PublishPress Authors plugin. This plugin lets authors edit their own profile and author photo by adding a new ‘Author Profile’ area to their WordPress dashboard.
It also gives site admins the power to edit the author’s profile including changing their photo.
First, you’ll need to install and activate the PublishPress Authors plugin. If you need help, then please see our guide on how to install a WordPress plugin.
Upon activation, head over to Authors » Settings. You can then go ahead and click on the ‘Display’ tab.
Once you’ve done that, open the ‘Layouts’ dropdown and choose a layout that includes an author photo.
Let’s look at your options.
The default layout is ‘Boxed.’ This shows the author’s information in a box, complete with their author photo.
The ‘Centered’ layout is similar to the boxed layout, but with all of the author’s information centered inside the author bio box.
‘Inline with avatar’ and ‘Simple List’ are both layouts that includes space for an author photo. Here’s an example of the Simple List layout.
Just be aware that those two layouts don’t have space for a bio. Even if the author has added a bio, it won’t be shown on your website.
After choosing your layout, click on the ‘Save Changes’ button. You can now visit your website to see the author photos on your WordPress posts and pages.
Anyone who has registered on your site with the Author role will now be able to upload a photo using the ‘Author Profile’s settings in their WordPress dashboard.
How To Change an Author’s Photo in WordPress
As admin, you can also use PublishPress Authors to change any of the individual author photos that appear on your website. This is useful if an author chooses a photo that isn’t a good fit for your site.
To change an author’s photo, simply go to Authors » Authors.
From here, you can click on an author’s ‘Edit Author Profile’ link.
Then, just click the ‘Image’ tab.
By default, PublishPress will try to find a gravatar that’s linked to the author’s email address. To use a different author photo, click on the ‘Custom image’ radio button.
Once you’ve done that, click on ‘Select Image.’ You can now choose any image from your WordPress media library, or upload a new image.
Then, just click on the ‘Update’ button.
Your website will now use this new image as the author’s photo.
Do you want to import external images in WordPress?
If you have recently moved your website from one platform or host to another, then there is a good chance that you may have external images embedded on your pages.
In this article, we will explain how to properly import those external images in WordPress.
Why Import External Images in WordPress?
External images are images embedded in your content that load from another website or URL different from your main WordPress website.
Most commonly, WordPress users come across external images issue after migrating their website from other platforms like Blogger, Weebly, Joomla, or WordPress.com.
By default, if you use one of the WordPress importers, then it will try to import images. You can see the imported images by visiting Media » Library page in your WordPress admin area.
If you see that all your images are already in the Media Library, but the image URLs in your posts still point to your old website, then you don’t need this article. Instead, you should follow our guide on how to easily update URLs when moving your WordPress site.
However, if you don’t see images imported to your WordPress media library, then continue reading and we will show you how to import those external images.
Upon activation, you need to visit the Settings » Auto Upload Images page to review the plugin settings.
The default settings would work for most users, but you can change them as needed.
For example, the plugin will import images to your default WordPress media uploads folder. You can change that by providing a different base URL. Other than that, it also allows you to set filename, image alt tag, image size, and exclude post types.
If you do make some changes, then don’t forget to click on the ‘Save Changes’ button at the bottom of the page to store the new settings.
Next, you will need to update the posts or pages containing the external images. Since this is a manual process, it can be tedious if you have a lot of content.
Luckily, there’s a quick way to update all posts with external images. Simply go to Posts » All Posts page and then click on the Screen Options button at the top.
You need to increase the number in the ‘Number of items per page field’ field to ‘999’ and click the ‘Apply’ button.
WordPress will reload the page, and this time it will show up to 999 posts at a time.
Note: If you have slow web hosting, your server may not be able to handle updating so many posts at once. In that case, you would want to do smaller batches of posts at a time, or consider switching to better WordPress hosting.
Next, you can select all of your posts on this page by clicking the checkbox next to ‘Title’. After that, you should select ‘Edit’ under the bulk actions menu and click the ‘Apply’ button.
WordPress will now show you a ‘Bulk Edit’ box with all selected posts.
You just need to click on the ‘Update’ button, and WordPress will update all your posts.
Remember, don’t change any of the settings in the bulk edit settings that you see. You just need to click the ‘Update’ button.
This will trigger the plugin to check all selected posts and import external images as it finds them.
If you have more than 999 posts, then you will need to visit the next page to select the remaining posts.
Various marketing scenarios may call for consulting a marketing specialist. A drop in sales, launching a new product or service, or an issue that might make or break your company’s image are just a few...
Already a $44 billion market, the pharmaceutical cold chain is still growing rapidly. In fact, cold chain storage companies are set to outpace the rate of growth of the traditional supply chain industry. Considering how...