Add Breadcrumbs To Your Theme

37 min read
Table Of Contents hide
1 Add Breadcrumbs To Your Theme – Full Guide

Add Breadcrumbs To Your Theme – Full Guide

 

  • Make Use of Online Learning Sources

WordPress learning resources abound on the internet. There are numerous resources and services available to assist you in mastering the art of website administration, including content libraries like WP Beginner. If you require assistance with WordPress-related content development, we recommend that you talk with Rush My Writing essay service pros.

  • Keep It Simple

As a beginner-level webmaster, you should keep things as simple as possible. You don’t want to start with sophisticated features right away; instead, focus on the fundamentals before moving on to more advanced capabilities. Themes and plugins are, of course, the first things to consider here.

  • Select a Good Theme

The theme you select will have a significant impact on the performance of your website. Our recommendation is to pick a WordPress theme that precisely aligns with your branding strategy while also allowing you to make alterations and modify it to your specific requirements.

  •  Eliminate Spam Comments

The fundamental purpose of creating a website is to generate content. Spam remarks in comments, on the other hand, do not make a WordPress site look professional. Your task is to eradicate spam using the following basic procedure:

  • Go to phpMyAdmin ? Database
  • Click SQL
  • Enter the code line: DELETE from wp_comments WHERE comment_approved = ‘0’;

 

  • Understand SEO Fundamentals

Search engine optimization (SEO) is the fundamental prerequisite for greater ranking in engine searches, so you must understand how it works. It’s a complicated issue that demands some research, but you must learn the fundamentals like keywords, slugs, and meta-descriptions.

  • Increase the Memory Limit

Plugins can overburden a WordPress website and deplete memory, making your site slower. To avoid this problem, raise the memory limit. Simply open the wp-config.php file and add the following code: define(‘WP MEMORY LIMIT,’ 64M);

  • Analyze Performance

Analytics is yet another critical part of website management. You must understand where your audience originates from, how much time they spend exploring your site, and so on. Google Analytics is the most basic tool for evaluating every aspect of a website’s operation.

  • Forget Image Carousels

Visual material is interesting and appealing, but you can’t just keep adding graphics without thinking about the user experience. Image sliders and carousels are especially irritating since they waste time and require visitors to perform unnecessary actions. Remove this type of content if you don’t want to increase your bounce rate.

  • Take Care of Security

Another important concern is website security since you don’t want to endanger months or even years of content creation. It is your responsibility to generate strong passwords and to use a trustworthy security plugin such as Sucuri or Wordfence.

  • Delete Obsolete Plugins

Inactive plugins can sometimes compromise your website’s security. Although this is not always the case, we nonetheless recommend that you deactivate any plugins that you do not use or do not intend to reactivate anytime soon.

  • Highlight Author Comments

The objective of the material you publish is to hook the audience and motivate them to engage. However, you should emphasise the author’s comments and make them stand out from the rest of the text. To do so, add the following code to the CSS file:.bypostauthor background: #eee;

  Create a Basic Site Structure

Your website should be simple to use, allowing users to reach where they want with only a few clicks. As a result, it is critical to create a straightforward website structure with up to six main categories that logically branch into the respective subcategories.

 Increase Load Speed

Users nowadays expect a webpage to load in three seconds or less, requiring administrators to optimise and improve website load time. You may accomplish this with internet tools such as Pingdom, a platform that evaluates site performance and provides practical advice on how to reduce load time.

 Include Social Share Buttons

Social media attracts billions of users every day, which can provide you with a lot of extra exposure. You may easily install a social share plugin and enable website users to share your material via their Facebook, LinkedIn, and other popular networks.

  Include Breadcrumbs in Your Theme

Many themes include breadcrumbs, but if you’re using one that doesn’t, it’s simple to add. Install the Breadcrumb NavXT plugin. After you install and activate it, you will have a new widget called Breadcrumb NavXT that you can use to display your breadcrumbs wherever you place it. If you want additional flexibility over where your breadcrumbs display, add the following code snippet to the template of your theme where you want the breadcrumbs to appear (e.g. single.php, archives.php, etc.). ?php if(function exaists(‘bcn display’)) bcn display(); You can change the style and appearance of your breadcrumb by navigating to Settings > Breadcrumb NavXT.

  Make Your Sidebar More Personal for Individual Posts

You can use the Custom Sidebars plugin to display a custom sidebar for specific posts or pages. This plugin allows you to display not only a custom sidebar but also widgets that are only visible in certain places of your WordPress site (like, for example, on the footer or header). After installing and activating the plugin, you’ll notice a new widget in the post editor that allows you to specify which individual widgets or sidebars you wish to appear in which location per post or page.

Add Breadcrumbs To Your ThemeYou can, for example, display your left sidebar in your footer, as shown in the image above. With a little creative tinkering, you can add a lot of versatility.

 Link to External Links from your Post Titles

Typically, the titles of blog articles are connected to the post’s URL on the site. If, on the other hand, the main objective of writing a blog post is to provide an external link, you may not wish to persuade users to open your post. Rather than that, visitors can access the external link directly from the homepage by clicking the title of the blog article. Add the following code to the functions.php file of your theme.

function print_post_title() { global $post; $thePostID = $post->ID;

$post_id = get_post($thePostID); $title = $post_id->post_title; $perm = get_permalink($post_id);

$post_keys = array(); $post_val = array(); $post_keys = get_post_custom_keys($thePostID);

if (!empty($post_keys)) { foreach ($post_keys as $pkey) { if ($pkey == ‘external_url_title’)

{ $post_val = get_post_custom_values($pkey); } } if (empty($post_val))

{ $link = $perm; } else { $link = $post_val[0]; } } else { $link = $perm; }

echo ‘<h2><a href=”‘ . $link . ‘” rel=”bookmark” title=”‘ . $title . ‘”>’ . $title . ‘</a></h2>’; }

Following that, locate the following code snippet in content.php, archive.php, category.php, and other template files. Please keep in mind that your theme may not utilise the exact same snippet, but as long as it is near, it should suffice. The presence of the “the title()” function is one indicator.

<?php the_title( sprintf( ‘<h2 class=”entry-title”>

<a href=”%s” rel=”bookmark”>’,

esc_url( get_permalink() ) ), ‘</a></h2>’ ); ?>

Replace this with: <?php print_post_title() ?>

You’re now through with the coding portion. Following that, you’ll need to use a custom field in the post where you want an external link to the title. Use ‘external url title’ in the name and then your external link in the value.
external post title linkCustom fields may not be enabled by default, in which case you will need to enable them first. If you’re using the classic post editor, select Screen Options in the upper-right corner of the page, then find and activate Custom fields. If you’re using Gutenberg, click the triple dot next to the gear icon in the upper right corner of the page, then select Options in the dropdown menu, then tick Custom fields under Advanced panels. There are more adjustments you can make to your site’s title and tagline for SEO purposes.

 Add Featured Image Support for Your Theme

Almost all themes currently include support for featured images by default. However, if you’re developing a custom theme or have an existing theme that lacks this feature, you can easily enable it by adding the following code to its functions.php file: add theme support(‘post-thumbnails’); Now, your theme should include a featured image.

  •  Custom CSS for Individual Posts

If you want to be able to add custom CSS to individual posts, paste the following code snippet just before the closing tag in your theme’s header.php file.

 

</head> tag: <?php if ( is_single() )

{ $customstyle = get_post_meta($post->ID, ‘customstyle’, true);

if ( !empty($customstyle) ) { ?> <style type=”text/css”>

<?php echo $customstyle; ?> </style> <?php } } ?>

To add a custom style to an individual post, simply create a custom field named customstyle and fill in the value with your CSS code.
individual post css

  •  Create Custom User Roles

By default, WordPress assigns the user roles administrator, editor, author, contributor, and subscriber. However, you may need to assign some specific user roles on occasion. Add the following lines to your theme’s functions.php file to accomplish this. You can toggle the availability of particular functions by setting the appropriate parameter to true or false. Additionally, you may alter the name of the custom role by editing the my custom role and

My Custom Role strings to your preference (the first one, with underscores, is the role name and the second one is the display name — which will be shown in the WordPress dashboard).

add_role( ‘my_custom_role’, __( ‘My Custom Role’), array( ‘read’ => true, // true allows this capability ‘edit_posts’ => false, // allows user to edit their own posts ‘edit_pages’ => true, // allows user to edit pages ‘edit_others_posts’ => false, // allows user to edit others posts not just their own ‘create_posts’ => false, // allows user to create new posts ‘manage_categories’ => false, // allows user to manage post categories ‘publish_posts’ => false, // allows the user to publish, otherwise posts stays in draft mode ‘edit_themes’ => false, // false denies this capability, user can’t edit your theme ‘install_plugins’ => false, // user can’t add new plugins ‘update_plugin’ => false, // user can’t update any plugins ‘update_core’ => false // user can’t perform core updates ) );

  •  Disable Admin Bar Except for Administrators

If you want to disable admin bar access to other all users except admin, add the following snippet to your theme’s functions.php file to disable access to non-administrator users: add_action(‘after_setup_theme’, ‘remove_admin_bar’); function remove_admin_bar() { if ( !current_user_can(‘administrator’) && !is_admin() ) { show_admin_bar(false); } } Now, all registered users except for the administrators will not see the admin bar when viewing the front-end even when they are logged-in.

  •  Add Author Bio Wherever You Want

Simply add the following lines to your theme’s single.php file to show author bio in your preferred location.

<?php global $post; ?> <?php $author_id = $post->post_author; ?> <?php if (get_the_author_meta(‘description’, $author_id)) : ?> <div class=”author-box”> <div class=”author-img”><?php echo get_avatar(get_the_author_meta(‘user_email’, $author_id)); ?></div> <h3 class=”author-name”><?php the_author_meta(‘display_name’, $author_id); ?></h3> <p class=”author-description”><?php the_author_meta(‘description’, $author_id); ?></p> </div> <?php endif; ?> Use the following CSS to style the author bio: .author-box { background-color: #fff; padding: 20px; margin: 0 0 40px; display: inline-block; width: inherit; } .author-box .author-img { float: left; margin-right: 20px; margin-bottom: 20px; } .author-box .author-img img { border-radius: 50%; } .author-box .author-name { font-weight: bold; clear: none; display: inline; }

  •  Replace “Howdy” Message from the Dashboard

If you want to replace the “Howdy” message from the dashboard, add the following code snippet to your theme’s function.php:

function replace_howdy ( $wp_admin_bar ) { $avatar = get_avatar( get_current_user_id(), 16 ); if ( ! $wp_admin_bar->get_node( ‘my-account’ ) ) return; $wp_admin_bar->add_node( array( ‘id’ => ‘my-account’, ‘title’ => sprintf( ‘Logged in as: %s’, wp_get_current_user()->display_name ) . $avatar, ) ); } add_action( ‘admin_bar_menu’, ‘replace_howdy’ ); Now, the message will be “Logged in as”.

  •  Make Featured Image Required for Publishing a Blog Post

If you want all posts to include a featured image, you can enforce it by requiring that no post be published without a featured image. Simply install the plugin Require Featured Image and all posts will now require a featured image before they can be published (by default).

Add Breadcrumbs To Your Theme

The plugin works on both the classic and the Gutenberg editor and can also check custom posts as well — you just need to enable checking them in the plugin’s settings via Settings > Req Featured Image.

  •  Add Confirmation Box When Publishing Pages & Posts

To publish a post with the new Gutenberg editor, you must click the Publish button twice. This prevents you from mistakenly publishing an incomplete post. However, there is no such thing in the traditional editor. Once you click the publish button, your content becomes live regardless of its readiness. However, there is a simple method that will prevent you from publishing your posts accidently when using the traditional editor. All you have to do is add the following code snippet to the functions.php file of your theme:

add_action( ‘admin_print_footer_scripts’, ‘publish_confirm’ ); function publish_confirm() { echo “<script> jQuery(document).ready(function($){ $(‘#publishing-action input[name=\”publish\”]’).click(function() { if(confirm(‘Are you sure you want to publish this?’)) { return true; } else { $(‘#publishing-action .spinner’).hide(); $(‘#publishing-action img’).hide(); $(this).removeClass(‘button-primary-disabled’); return false; } }); }); </script>”; }

When you click the Publish button from now on, a confirmation box will appear asking you to confirm that you truly want to publish the post or page.

  •  Redirect to Custom Page After Registration

If you want to redirect users to a custom page after registering to your website, you can use the following code snippet (add this to your theme’s functions.php file): function __my_registration_redirect(){ return home_url( ‘/custom-page’ ); } add_filter( ‘registration_redirect’, ‘__my_registration_redirect’ );

Where custom-page is your custom page url.

  •  Add Social Profile Information on the User Profile Page

Previously, users could add their AIM, Yahoo IM, Jabber/Google Talk contact information to their profile page, but WordPress removed this functionality due to the majority of these services being obsolete. Currently, a user or author can only include their email address and website in the Contact Info box.

Related Post  HTTP Error while Uploading Image

contact info

You may quickly add more contact forms here, such as Facebook, Twitter, and so on, using this WordPress trick. To accomplish this, include the following code in your theme’s functions.php file: function

my_new_contactmethods( $contactmethods )

{ // Add Twitter $contactmethods[‘twitter’] = ‘Twitter’; // Add Facebook $contactmethods[‘facebook’] = ‘Facebook’; return $contactmethods; } add_filter(‘user_contactmethods’, ‘my_new_contactmethods’, 10, 1);

The above code snippet will add fields for Twitter and Facebook. You can add other social networks as well if needed by using the format: $contactmethods[‘new_contact_name’] = ‘Field Label’;

The new_contact_name is your new contact info identifier (which is also the one you’ll need to call when you need to display it on your frontend) while the Field Label is what will be displayed on the WordPress dashboard as the label for the new contact info item.

To display these new contact info, you need to add this code snippet to your theme’s author.php file: <?php echo the_author_meta(‘twitter’); ?>

The above will return the user’s Twitter contact info. You can do the same for any other fields that you add.

  •  List All Authors of Your Blog on a Page

To list all authors of a page, we’re going to use the functions.php file, to add a new shortcode. Add the snippet below to your theme’s functions.php file:

function collective_ray_list_authors() { $authors = get_users(array( ‘orderby’ => ‘post_count’, ‘order’ => ‘DESC’, ‘count_total’ => ‘false’, ‘role__in’ => [‘author’] )); $output = ”; if($authors): $output .= ‘<div class=”author-list”>’; foreach($authors as $author): $author_id = $author->ID; $user_archive_url = get_author_posts_url($author_id); $user_posts_count = count_user_posts($author_id); $user_avatar = get_avatar(get_the_author_meta(‘user_email’, $author_id)); $user_display_name = get_the_author_meta(‘display_name’, $author_id); $user_bio = get_the_author_meta(‘description’, $author_id); $output .= ‘<div class=”author-box”>’; $output .= ‘<div class=”author-img”>’ . $user_avatar . ‘</div>’; $output .= ‘<h3 class=”author-name”>’ . $user_display_name . ‘</h3>’; $output .= ‘<p class=”author-description”>’ . $user_bio . ‘</p>’; $output .= ‘<a href=”‘ . $user_archive_url . ‘”>’ . ‘View all posts by ‘ . $user_display_name . ‘ (‘ . $user_posts_count . ‘)</a>’; $output .= ‘</div>’; endforeach; $output .= ‘</div>’; endif; return $output; } add_shortcode(‘author_list’, ‘collective_ray_list_authors’); After that, add the following CSS code to your theme’s

Additional CSS: .

author-box { background-color: #fff; padding: 20px; margin: 0 0 40px; width: inherit; } .author-box .author-img { float: left; margin-right: 20px; margin-bottom: 20px; } .author-box .author-img img { border-radius: 50%; } .author-box .author-name { font-weight: bold; clear: none; display: inline; } .author-box a { text-decoration: none; }

Now you can use the shortcode [author_list] to display all authors on a post or page of your choice.

  •  Add Guest Author to WordPress without Registration

The majority of guest authors are one-time publications, which is especially true if your site accepts guest contributions. As a result, there is no reason to create a separate profile for them. However, how do you present the information about the guest author? Simply put, there is a plugin called (Simply) Guest Author Name that enables you to add a guest author to individual posts. You can also provide a link to the guest author’s webpage, social media profile, or any other website. After installing the plugin, a new field will appear at the bottom of your posts for you to enter the information for a guest author.

guest author no registration

Simply fill this out and this information will be displayed in the author metadata of the current post.

  •  Insert Google Analytics Code

Previously, you needed to utilise a third-party plugin or manually add code snippets to the header of your website. Today, Google offers an official plugin called Site Kit by Google. This will enable you to connect your website to Google and enable Google Analytics to be immediately activated on your site. Simply download the plugin and follow the on-screen directions to complete the installation. After setting it up, you can configure Google Analytics on your site by heading to Site Kit > Analytics and configuring it.

Add Breadcrumbs To Your Theme

  •  Setup A/B tests Using Google Optimize

After installing Google Analytics using the Site Kit by Google plugin, you can now perform A/B tests via Settings > Connect More Services > Setup Optimize.

AB testing

This will connect your Google Optimize account to your website, allowing you to effortlessly conduct A/B tests. Nota bene: You may need to configure your Google Account’s Optimize ID first. After installing Optimize and linking it to your website using Site Kit, navigate to https://optimize.google.com/ and construct your experience.

  •  Track file downloads using Google Analytics and Google Tag Manager

To track file downloads using Google Analytics, set up Tag Manager in Site Kit by Google. To do that, go to Site Kit > Settings > Connect More Services tab and then setup tag manager.

tag manager setup

This will urge you to establish a Site Kit connection between your Google Tag Manager account and your website. Once it’s configured and connected to your website, navigate to https://tagmanager.google.com/. Select the container to which your WordPress site is connected (make sure the container ID matches). Then, on the page’s left side, click Tags, followed by New. You can call it anything you like, but for this example, we’ll call it “Track Downloads.”

Add Breadcrumbs To Your Theme

Next, click the Tag Configuration box and in the menu that appears, click Google Analytics: Universal Analytics.

How To Add Breadcrumbs To Your Theme

Then, follow the settings below:

  • Track Type: Event
  • Category: Document Download (type it out — note that this can be whatever you want)
  • Action:
    • Click the button with a + inside a battery like icon.
    • This will open a sliding window asking you to choose a variable.
    • Click “Built-ins”.
    • Find and select Click URL.
  • Label:
    • Click the button with a + inside a battery like icon.
    • This will open a sliding window asking you to choose a variable.
    • Find and select Page Path.
  • Google Analytics Settings:
    • Click New Variable
    • In the variable configuration window, put your Tracking ID in the tracking ID field.
    • Save

All other settings should be left alone. Following that, click on the Triggering section. Click the + button in the upper right part of the Choose trigger screen that will open. You will be prompted to Choose a Trigger Type when you click the Trigger Configuration section. Under the Click section, select Just Links. Then, under This trigger fires on, select Some Link Clicks. Adhere to the following settings:

trigger configuration

The regex expression we used is as follows: \.(pdf|xlsx|png|docx) $ This allows you to keep track of downloads for any file with the pdf, xlsx, png, or docx extension. Save your trigger (if you haven’t already, you will be prompted to name it — you may name it whatever you want — in our example, we named it “Track Downloads”). Your final screen should now appear as follows:

How To Add Breadcrumbs To Your Theme

You’re now ready to save it and you’re done!

  • Hide Ads for Single Posts

If you now display adverts on each blog post and wish to conceal them for a specific post, just add the following code to your single.php file. Ensure that you change xx with the post id and add your advertisement code to the following code snippet. if(get the ID()!= xx) Your advertisement code here

  • Wrap Ads in Post Wherever You Want

Occasionally, you’ll want to manually control where your adverts display with a shortcode. This does not require the use of a plugin. This is how: Add the following code snippet to your theme’s functions.php file. Additionally, ensure that you include your advertisement codes within it. Replace

YOUR ADSENSE CODE GOES HERE with your own AdSense code snippet. function display_adsense() { ob_start(); ?>

YOUR ADSENSE CODE GOES HERE <?php return ob_get_clean(); }

add_shortcode( ‘col_ray_adsense’, ‘display_adsense’ );

All you have to do now is include the shortcode [col ray adsense] within your articles or pages, and your advertisements will appear exactly where you want them to.

  • Export Email Addresses from User Submitted Comments

Execute the SQL query below against your database to export all user-submitted email addresses that are unique. This can be beneficial when it comes to growing your email list. SELECT DISTINCT comment author email FROM wp comments; As a result of GDPR’s introduction, this must be explicitly stated and agreed upon as part of your privacy policy. Additionally, you must double opt-in users who are added to your mailing list in this manner.

  • Block Specific IP Address

Add the following lines to the.htaccess file to prevent access to your site from specific IP addresses. *Files> Order Permit, Deny Permit from all Refuse access from xxx.xxx.xxx.xxx /Files> You can replace the xxx with various patterns to block a single IP address, several IP addresses, entire IP ranges, or whatever else you require. More information on how to accomplish this may be found at https://htaccessbook.com/block-ip-address/.

  • Exclude Pages from Search

If you want to avoid displaying pages in the search results, add the following code snippet to your theme’s functions.php file. function modify_search_filter($query) { if ($query->is_search) { $query->set(‘post_type’, ‘post’); } return $query; } add_filter(‘pre_get_posts’,’modify_search_filter’);

  • Add Promotional Content on the Homepage Above the Articles

To accomplish this, you must update the index.php file for your theme. Then, locate the div class=”content-loop”> and immediately beneath it, put your promotional content, such as a newsletter registration form or advertisements. Take note that not all themes create their index.php file using the exact same code and structure. Occasionally, it could be any of the following:

<div class=”primary”>

<main id=”main”>

<div id=”page-content”>

<main id=”site-content” role=”main”>

Again, not all themes will use these, some use other combinations, but they should always be in the index.php file and are always near the top.

  • Limit Access to Login Page for Specific IP Addresses

Add the following to your site’s .htaccess file: <Files wp-login.php> Order Deny,Allow Deny from all Allow from xx.xx.xx.xx </Files> Replace xx.xx.xx.xx with your own IP address. With this, only you can access the login page.

  • Create a Manual Backup of your Database

Log into phpMyAdmin and choose the WordPress database to backup. To get started, navigate to the Export tab and click the Go button at the bottom of the page. When prompted by your browser to download the backup, click yes. You now have a database backup!

How To Add Breadcrumbs To Your Theme

  • Restore your WordPress Database

If you used the preceding approach to build a manual backup of your site, you may ultimately need to restore it. Log in to phpMyAdmin, pick your WordPress database, choose the Import tab, click Choose File, then browse to the database you want to restore from your hard disc. Following that, click the Go button.

restore database

  • Use SSL Mode for Login

If your server is configured with an SSL certificate, you can compel your WordPress installation to use SSL mode for safe user login. Add the following code to the wp-config.php file to accomplish this. ‘FORCE SSL ADMIN’, true); define(‘FORCE SSL ADMIN’, true); Additionally, if you wish to avoid the effort of procuring an SSL on your own, our host, InMotion, offers SSL hosting via their InMotion shared accounts. Our whole assessment is available at https://www.collectiveray.com/inmotion-hosting-review.

  • Restrict Access to wp-includes Folder

Adding this to your .htaccess file will deny all access to your WordPress site’s wp-includes files and directory: # Block wp-includes folder and files <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^wp-admin/includes/ – [F,L] RewriteRule !^wp-includes/ – [S=3] RewriteRule ^wp-includes/[^/]+\.php$ – [F,L] RewriteRule ^wp-includes/js/tinymce/langs/.+\.php – [F,L] RewriteRule ^wp-includes/theme-compat/ – [F,L] </IfModule>

  • Disable Template File Editing

Any WordPress user with administrator access can edit templates by navigating to Appearance > Editor. If you have multiple administrators on your site, it is a good idea to disable this feature. You can do that by adding the following line of code to wp-config.php: define( ‘DISALLOW_FILE_EDIT’, true );

  • Hide Version Number

Specific WordPress versions might have vulnerabilities that can be exploited. If a hacker manages to identify which version of WordPress you’re using, he can use that information to gain control of your website through such known vulnerabilities. By inserting the below code to your functions.php you will hide the WP version number, which will be an added protection for your site. remove_action(‘wp_head’, ‘wp_generator’);

  • Disable access to specific file types

Create a new .htaccess file, add the following code and upload the file inside the wp-content folder. # Disable access to all file types except the following Order deny,allow Deny from all <Files ~ “.(xml|css|js|jpe?g|png|gif|pdf|docx|rtf|odf|zip|rar)$”> Allow from all </Files> This will disable access to all file types except the mentioned files in the code.

  • See Recently Modified Files

If you have SSH access to your server, sign in and run the command below to see the recently modified files. This command comes in handy especially if you are suspecting vulnerable access to your server without your consent. The below command will show changes made in the last 2 days in the specified directory. find /home/yourdirectory/yoursite/ -mtime -2 -ls

  • Manually Reset Your Password

Log in to phpMyAdmin, select your website’s database, go to the SQL tab and paste the following command in the text box and click the Go button: UPDATE `wp_users` SET `user_pass` = MD5( “PASSWORD” ) WHERE `wp_users`.`user_login` = “ADMIN”;

Related Post  WordPress Theme Vs Template

How To Add Breadcrumbs To Your Theme

Note: Make sure you change the “ADMIN” to your actual username and “PASSWORD” to your preferred password. Do NOT use PASSWORD as the actual password because your website will get hacked.

  • Deactivate All Plugins Even if You’re Unable to Access the Dashboard

Often, deactivating all plugins is necessary during troubleshooting. However, if you are unable to enter into your dashboard due to an unfortunate circumstance, you can disable all plugins using FTP or CPanel, File Manager Access. Change the plugins folder’s name to something other, such as wp-content-backup, under the wp-content/ directory. This will automatically deactivate/disable all of your plugins, restoring access to your dashboard in the event that one of those plugins is causing a problem.

  • Show All Active Plugins

You may wish to obtain a list of active plugins on a specific WordPress installation for maintenance needs. By pasting the following code into the functions.php file, you’ll see a widget on your dashboard listing all active plugins.

add_action(‘wp_dashboard_setup’,’wpse_54742_wp_dashboard_setup’); function wpse_54742_wp_dashboard_setup() { wp_add_dashboard_widget(‘wpse_54742_active_site_plugins’, __(‘Active Plugins’),’wpse_54742_active_site_plugins’); }

function wpse_54742_active_site_plugins() { $the_plugs = get_option(‘active_plugins’);

echo ‘<ul>’; foreach($the_plugs as $key => $value)

{ $string = explode(‘/’,$value);// Folder name will be displayed echo ‘<li>’.$string[0].'</li>’; } echo ‘</ul>’; }

  • Easily Prevent Comment Spam

Rather than labelling each comment as spam, you can prevent spammers from publishing comments on your site entirely. The following code checks for an HTTP referral and automatically disables the comment if it is invalid.

Add the following code in your theme’s functions.php file: function check_referrer() { if (!isset($_SERVER[‘HTTP_REFERER’]) || $_SERVER[‘HTTP_REFERER’] == “”) { wp_die( __(‘Please enable referrers in your browser, or, if you’re a spammer, bugger off!’) ); } } add_action(‘check_comment_flood’, ‘check_referrer’);

  • Remove Post Date Stamp from SERP

If your content is not time-sensitive, make sure you avoid displaying WordPress post date stamps on SERP, which will increase the CTR of your posts that display on SERP. Go to single.php file and find something like this: <?php the_time(‘F jS, Y’) ?>Replace it with the following code: <script language=”javascript” type=”text/javascript”>document.write(“<?php the_time(‘F jS, Y’) ?>”);</script>Some themes won’t have the same exact code and some themes, like GeneratePress allows you to remove dates completely by adding a filter, so if this doesn’t work, you can consult your theme’s developer for more information.

  • Prevent Image Hotlinking

Protecting your images from hotlinking will help you save lots of bandwidth by preventing other sites from displaying or even embedding your images on their own sites. Simply go to .htaccess file and add the following code. Make sure you replace the ‘your-domain-name-here’ part with your actual domain name.

RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?your-domain-name-here [NC] RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L] 89. Disable HTML in comments Spammers are used to submitting tons of HTML links in comments, which can have negative impact in bringing organic traffic to your website.

You can fix this by preventing all HTML from the comment, leaving only the text. Simply open functions.php and insert the following code to disable HTML elements in comments. //

This will occur when the comment is posted function plc_comment_post( $incoming_comment ) { // convert everything in a comment to display literally $incoming_comment[‘comment_content’] = htmlspecialchars($incoming_comment[‘comment_content’]); // the one exception is single quotes, which cannot be #039; because WordPress marks it as spam $incoming_comment[‘comment_content’] = str_replace( “‘”, ‘&apos;’, $incoming_comment[‘comment_content’] ); return( $incoming_comment ); } //

This will occur before a comment is displayed function plc_comment_display( $comment_to_display ) { // Put the single quotes back in $comment_to_display = str_replace( ‘&apos;’, “‘”, $comment_to_display ); return $comment_to_display;

And who else besides search engines is important to our websites? Social networks of course! Here are WordPress social network tricks. Of course, your blog would be nothing if it’s not social today – here’s a few more WordPress tips tricks and tweaks for socialing your blog.

  • Restrict Bots Access

By preventing abusive bots from accessing your website, you can tighten the security of your WordPress blog. Copy the following code to .htaccess file.

SetEnvIfNoCase User-Agent ^$ keep_out SetEnvIfNoCase
User-Agent (pycurl|casper|cmsworldmap|diavol|dotbot)
keep_out SetEnvIfNoCase User-Agent (flicky|ia_archiver|jakarta|kmccrew)
keep_out SetEnvIfNoCase
User-Agent (purebot|comodo|feedfinder|planetwork)
keep_out Order Allow,Deny Allow from all
Deny from env=keep_out

Disable Self Pingbacks

If your site has pingbacks enabled, each time you link to one of your own posts, you will generate a pingback. This can be disabled using the following code snippet. To disable self pingbacks, add the following code to your functions.php file.

function disable_self_trackback( &$links )
{ foreach ( $links as $l => $link ) if ( 0 === strpos( $link, get_option( ‘home’ ) ) ) unset($links[$l]); }
add_action( ‘pre_ping’, ‘disable_self_trackback’ );

  •  Redirect Traffic from non-www to www

You can easily 301 redirect all the traffic from non-www to www version by adding the following code to the .htaccess file:

RewriteEngine on RewriteCond %{HTTP_HOST} ^yourwebsite\.com RewriteRule ^(.*)$
https://www.yourwebsite.com/$1 [R=301,L]

Don’t forget to replace “yourwebsite.com” with your own domain name.

  •  Show the Number of Search Results Found

Display the number of search results found in your WordPress search results page by adding the following line of code to your theme’s search.php file.

<h2 class=”pagetitle”>Search Result for
<?php /* Search Count */ $allsearch = new WP_Query(“s=$s&showposts=-1″);
$key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(”); _e(‘<span class=”search-terms”>’);
echo $key; _e(‘</span>’); _e(‘ — ‘); echo $count . ‘ ‘;
_e(‘articles’); wp_reset_query(); ?></h2>

  •  Exclude Categories from Search

When a user conducts a search on your site, you may occasionally wish to hide search results from a category that contains promotional content, portfolio items, or similar items. Simply add the following code to the functions.php file to disable search for specified categories.

function exclude_category_from_search($query) { if ($query->is_search)
{ $query->set(‘cat’, ‘-24,-45,-52’); }
return $query; } add_filter(‘pre_get_posts’,’exclude_category_from_search’);
The important part here is this line: $query->set(‘cat’, ‘-24,-45,-52’);

This tells WordPress which categories we want to exclude from search via their IDs. In this example, we are excluding categories with IDs of 24, 45 and 52. You must replace them with the category IDs of the ones you want to exclude (note: the minus sign [-] must be included!).

  •  Delete All Pingbacks

Execute the following SQL query against your database using phpMyAdmin to erase all pingbacks. As is customary with WordPress advice, deleting items from the database might create irreversible damage to your website. Make duplicates! WHERE comment type = ‘pingback’; DELETE FROM wp comments

  • Disable HTML in comments

Execute the following SQL query against your database using phpMyAdmin to erase all pingbacks. As is customary with WordPress advice, deleting items from the database might create irreversible damage to your website. Make duplicates! WHERE comment type = ‘pingback’; DELETE FROM wp comments

  •  Show Selective Tweets

How To Add Breadcrumbs To Your ThemeIf you’re using a personal Twitter account, you may not want every tweet to be visible to your blog readers. In such instances, you can show only tweets that contain a specific keyword or hashtag to your blog visitors. Navigate to Twitter Widgets>> click the ‘make new’ button >> select the’search’ tab. Enter from:dartcreations webdesign in the search query field. Substitute your twitter account for dartcreations and webdesign with your selected inquiry. Save your widget and paste it into your WordPress site’s widgets section.

  • Redirect Feeds to FeedBurner Feeds

Add the following code to .htaccess for turning WP feeds to FeedBurner feeds.

<IfModule mod_rewrite.c>
RewriteEngine on RewriteCond %{HTTP_USER_AGENT} !
FeedBurner [NC] RewriteCond %{HTTP_USER_AGENT} !
FeedValidator [NC] RewriteRule ^feed/?([_0-9a-z-]+)?/?$
https://feeds.feedburner.com/yourfeed [R=302,NC,L]
</IfModule> Make sure you customize the above code with your
FeedBurner feed URL (https://feeds.feedburner.com/yourfeed — replace this with your URL) before saving.

  • Category-specific RSS feeds

It’s a good idea to allow readers to subscribe to a specific category on your blog, especially if your site covers a wide variety of topics. Simply append /feed to the end of the URL for the category. Nota bene: this only works if you’ve enabled custom permalinks!

  • Delay Posting to RSS feeds

When you publish a blog article, it immediately notifies your readers via RSS feeds. You can set a one-hour delay on posting to RSS feeds. This can be advantageous if you forget to check your posts for broken links or errors before releasing them. function

Delay_RSS_After_Publish($where) { global $wpdb; if (is_feed()) { $now = gmdate(‘Y-m-d H:i:s’); $wait = ’60’; $device = ‘MINUTE’; $where.=” AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, ‘$now’) > $wait “; } return $where; }

add_filter(‘posts_where’, ‘Delay_RSS_After_Publish’);

  • Add Social Media Sharing Buttons

Today, social networking sites are extremely popular. Hundreds of millions of individuals use various social media sites on a regular basis, so having your material shareable across them makes sense. Shared Counts is one of the greatest plugins for adding social network sharing buttons. It’s a straightforward and lightweight plugin that enables you to add the following:

  • Facebook Share Button
  • Pinterest Pin Button
  • Yummly Button
  • Twitter Tweet Button (using the third-party Twitcount.com API)
  • Email Sharing (with reCAPTCHA support to prevent abuse)
  • Share Count Total
  • Print Button
  • LinkedIn Share Button

 

  • Back-Up the Website Regularly

While the final point on our list is self-evident, we can never overstate the importance of backups. Regularly backing up your website ensures that the content remains secure in the event of virus attacks or any other digital threat. 2022 WordPress Tips and Tricks

  • Image Resolution at Its Best To begin, incorporate photos into your blogs if you haven’t previously. Images help organise, read, and optimise your blogs. Second, it is critical to use the appropriate image size. You do not want a pixilated image, as this will create a negative impression on your reader and will ultimately reduce the number of views on your website. However, you do not require an excessively high-resolution image, as this would slow down your website.

So, find the right balance depending on the size you want to display.

  • Utilize an SEO plug-in Not everyone is an expert in SEO, which is acceptable; there are tools available to assist you. An SEO plugin assists you with on-page optimization, which refers to the adjustments and improvements you may make to your blog in order to make it more SEO-friendly and rank higher on Google’s search results page.

Yoast SEO plugin is one of the most recommended SEO-plugins.

  • Insert Alt Texts and Title Tags So you’ve uploaded images to your blog and they’re the correct size; what’s next? The alt text is the text that your reader will view in the event that the image does not load. Thus, Alt Texts improve the readability of your blog and also contribute to on-page optimization.

Title tags aren’t visible to your audience, but it is still advisable to add them as they still affect the SEO of your page.

  • Optimize the Excerpts While writing an excerpt, keep in mind that:

The excerpt should be intriguing enough to pique the reader’s curiosity. It should succinctly express the article’s point. It should not exceed the theme’s display limit. Always set aside more time to write an extract for your post. It’s a small thing, but it helps increase the number of visitors to your page.

  • Choose a Responsive Theme It’s self-evident that the majority of people today access the internet via mobile devices rather than PCs. You’re most likely viewing this on your mobile device as well. As a result, it is critical that your website is mobile-friendly. Otherwise, the reader will just click away to another website in a matter of seconds due to the excessive competition.
  • Utilize headers and sub-headings Any reader would rather read an article that is properly arranged and paragraphed than a large block of unformatted information. Even if this article were not divided into points, you would not be reading it. Bear in mind that the simpler you make things for your audience, the more visitors your website will receive. Additionally, sub-headings aid in the ranking of your content on Google.
  • Ascertain that the website is simple to navigate Again, there is too much competition and the public is impatient. If the reader encounters any difficulty locating the information they require, they will navigate to another website. Therefore, ensure that your website is user-friendly and extremely simple to navigate.
  • Engage Your Audience Your website’s success is largely dependent on your viewers, so treat them as such. Include a call-to-action in your blogs, e.g., solicit their input, inquire about what they’d want to read next, invite readers to remark, and then respond to their comments. This would establish a bond of trust between you and your audience and encourage them to return.

And the plus point is, that this convinces Google that your page is genuine and you get ranked better. So a win-win!

  • Attempt to Avoid Spam Comments Just as genuine engagement benefits a website’s ranking, spam comments make your post appear to be a fraud and have a detrimental effect on the ranking. You certainly do not want that, correct?

So, steer clear of spam comments.

  • Promote Now that you’ve developed high-quality content and optimised it as much as possible for search engines, it’s time to advertise. And certainly, promotion is necessary regardless of how amazing your content is, as people must first learn about your website in order to appreciate it.

If you’re new to blogging and aren’t interested in spending money on promotion, you can utilise your social media channels to spread the word about your website. Quora is an excellent site for promotion because users come there to read and seek answers and will not hesitate to browse your article.

It’s possible that you’re not particularly tech smart and are unfamiliar with themes, plugins, and how to maintain your website current. For this reason, there are WordPress Support Companies such as WP-Win that can assist you in maintaining your website so that you may focus on writing rather than technical details.

What are the difficulties you encounter while blogging? Kindly notify us.

Wrapping Up – How To Add Breadcrumbs To Your Theme

The 101 WordPress tips tricks and modifications listed in this article are included because we believe they are some of the best improvements for WordPress that can be implemented quickly and easily without the need to engage a developer or web designer. These are little adjustments to the code that you may make yourself in a short period of time without jeopardizing the failure of your website or WordPress template.

Leave a Reply

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

CommentLuv badge