Category - Web

1
Woocommerce Custom Sidebar on Shop Page (Without using a plugin)
2
How To Delete Your Reddit Account (Updated 2021)

Woocommerce Custom Sidebar on Shop Page (Without using a plugin)

After working with Woocommerce recently, I discovered that out of the box, Woocommerce displays the main blog sidebar on the shop pages.

Since the main WordPress sidebar contains blog-related widgets by default, this is clearly far from ideal.

I wanted instead for the Woocommerce shop page to have it’s own sidebar, with widgets related to searching and filtering products, not posts.

After digging through the code looking for a clean solution, I found that the solution is easy, and it’s as clean as copying a single template file and making a minor edit.

1. Create your new Widget Area

In your website’s filesystem (using your OS’s file explorer if it’s local to your machine, or via SFTP if it’s a remote webserver), navigate to your theme’s directory (/wp-content/themes/THEMENAME/) and edit the functions.php file.

At the end of the file, add the following code:

function custom_widgets_init() {
	register_sidebar(
		array(
			'name'          => esc_html__( 'Shop Sidebar', 'sirius' ),
			'id'            => 'sidebar-shop',
			'description'   => esc_html__( 'Add widgets here.', 'sirius' ),
			'before_widget' => '<section id="%1$s" class="widget %2$s">',
			'after_widget'  => '</section>',
			'before_title'  => '<h4>',
			'after_title'   => '</h4>',
		)
	);
} 
add_action( 'widgets_init', 'custom_widgets_init' );

If you already have a function attached to the widgets_init action, you can just add the call to register_sidebar into it.

2. Add widgets to your new widget area

Drag some widgets into your new widget area. Here are a few relevant Woocommerce widgets you might find appropriate:

  • Product Search
  • Filter Products by Attribute
  • Product Categories
  • Product Tag Cloud
  • Products By Rating
  • Recent Viewed Products

Adding widgets to the widget area

 

3. Create a custom shop sidebar template

Now we’re ready to create the template file which will output the new sidebar on the frontend of your website.

In your website’s filesystem (using your OS’s file explorer if it’s local to your machine, or via SFTP if it’s a remote webserver), navigate to your theme’s directory (/wp-content/themes/THEMENAME/) and copy the sidebar.php file to sidebar-shop.php

Edit the new sidebar-shop.php template using your favourite text editor and change any references to ‘sidebar-1’ to ‘sidebar-shop’

Here is the content from my sidebar-shop.php file.

<?php
/**
 * The sidebar containing the main widget area
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package Sirius
 */
 
if ( ! is_active_sidebar( 'sidebar-shop' ) ) {
	return;
}
?>
 
<aside id="secondary" class="widget-area">
	<?php dynamic_sidebar( 'sidebar-shop' ); ?>
</aside><!-- #secondary -->

And you’re done!

Now when you visit the shop page on the frontend of your website, you should see your shop sidebar instead of the main sidebar which is displayed when visiting the rest of your site.

If that was helpful, I’d really appreciate you taking the time to share this post on social media. You may also like to check out some of my other Woocommerce and WordPress related posts.

How To Delete Your Reddit Account (Updated 2021)

Reddit is one of the world’s largest online community-driven forums, with a total number of over 330 million users at the time of writing. The website hosts a huge range of subreddits (individual forums), covering all kind of subjects including /r/the_donald, which is used by supporters of Donald Trump, to /r/funny, which is where people share comics and memes.

Why are people deleting their Reddit accounts?

Despite its popularity, Reddit has experienced a mass exodus in recent years. There are a number of possible factors which may have caused this, however, a number of people have cited the website’s increasingly draconian censorship measures as a prime reason for them leaving the site.

Censorship on Reddit

According to our source, moderators are actively shadow banning users who express right-leaning political views or even some users who have expressed criticism of the CCP (The Chinese Communist Party). Moderators often cite “hate speech” as the broad reason for their censorship.

Political Discrimination

One of the most prevalent and highly visible problems experienced by Reddit users is the left-wing political bias. It remains a fact that many users who have expressed criticism of the Democrat party, or who have made comments in support of the Republican party have seen their accounts banned from the popular /r/politics subreddit. This has caused many to agree that the site is a left-wing echo chamber.

Information Security

Another quite worrying event was the removal of a warrant canary in 2016. A warrant canary is a text file on a web server which regularly has a sentence added along the lines of “At x time on x date, we have not received any government order to hand over our user’s private data. If the updates stop, it generally means that the website owners have received a court order forcing them to turn in their user’s private information. Well, in 2016 that is exactly what happened. The warrant canary was suddenly removed, indicating that a warrant was received.

Can you deactivate a Reddit account?

At the time of writing, there is no way to simply deactivate your Reddit account. If you want to close your reddit account, permanent deletion is the only option. When you delete a Reddit account, the effects are permanent; you will not be able to log in to the account again.

Can I back up my Reddit account data and posts?

Prior to deleting your account, you may want to back up your forum posts or other account data first. Unfortunately, there is no simple way to do this, however, some people have had success with requesting a dump of their data from the Reddit help team on reddithelp.com.

How do I delete my Reddit account?

If you are ready to pull the plug and permanently delete your Reddit account, follow the steps below.

Please be aware that deleting your account will not remove any of the comments you made with that account. Instead, the comment author will just be changed to ‘[deleted]’. If you would like to delete comments, you will have to do it before deactivating your account.

The instructions below are aimed at users with a desktop or laptop computer, but you should be able to follow the same process on a mobile phone or tablet. The process should remain the same, but some of the button positions may be different.

Step 1: Log in to Reddit

Before you can delete your account, you have to log in. If you have forgotten your password, then you can do a password reset first. In this case, a reset link will be sent to your registered email account.

Log in to Reddit

 

Step 2: Select your username

Once you have logged in, go ahead and click on your username at the top right of the main navigation bar. A menu should drop down with a list of options.

Select your Username

 

Step 3: Choose ‘User Settings’

Click on the ‘User Settings’ option from the dropdown menu. A popup modal window should appear with a form on it.

Choose User Settings

 

Step 4: Deactivate Account

Scroll to the bottom of the popup window and click on the ‘Deactivate Account’ link. A popup confirmation window will appear .

Click Deactivate Account

 

Step 5: Confirm Deactivation

Before you can fully delete your account, you will have to log in again using your username and password. Then it’s just a case of clicking the red ‘Deactivate’ button. Clicking the button will permanently delete your Reddit.com account.

Confirm Deactivate

 

Copyright © 2018. Created by Hayden Kibble.