Posted on 5 Comments

How To Change Link Color in WordPress

How To Change Link Color in WordPress 1

Your WordPress site’s link color is defined by the theme you use. If the theme doesn’t specify a rule for link color, then the default color by the browser is applied. As a rule of thumb, link should be styled in a way that visitors know that is a link(blue color, cursor changed to a hand when hover on it). However, there are times theme author uses a different color that makes the links look strange.

Then, you wonder, how can you change link color in WordPress?

The answer may surprise you because it’s fairly easy.

Do you know CSS?

Knowing CSS, even at the very basic level can be super helpful when you want to customize your site. Most of WordPress themes nowadays provide a section call Additional CSS under Apperance->Customize so you can add your own styling. So, if you know how to write CSS, you can easily edit anything related to style on your site.

But if you don’t know CSS, don’t worry because I’ll walk you through.

Here are the steps you need to do to change link color in WordPress

  1. Find the color you want to use as link color
  2. Find the selector of the link on your site
  3. Write the rule in Additional CSS box
  4. Apply the changes and see the effect

Now, let’s get started

Step by step to change WordPress link color

Find the color you want to use as link color

The first step is to get the code of the color you want to use. If you go to google and search for color picker, chances are you’ll see one provided by Google:

color picker by google

This is a good one. You simply drag the sider at the bottom to get the to the base color (Blue for example) and then position the circle to pick the exact color you want to use.

When you are happy with your selection, let’s look at the left and see the string that begins with the # sign.

That’s your color code.

In my case, my color code is #5495ff

get the color code from color picker

Find the selector of the link on your site

The next step is to find the selector of links on your site. Normally, the link tag starts with <a. You may be tempted to use a as the selector as in this example:

a {
    color: #5495ff
}

It may or may not work depends on the theme you are using. To increase the chance of our color is applied to the link, we need to add a bit more specificity.

Now, go to your site, find any link and right click on it, select Inspect (I’m using Chrome but you can use Firefox too).

inspect a link

Depends on your browser settings, you’ll see a new window appears either at the bottom of the browser or at the right side.

Let’s look at the window:

find the selector for link in wordpress

As you can see, we have the link element starts with <a here. You’ll also notice that this one is the child of an element with and ID named “secondary”. In addition, the div with the ID secondary is the child of another div with class “container”.

So, to apply the color above to all links in the div with “secondary” ID, we can write the rule as follow:

.container #secondary a { 
    color: #5495ff 
}

Write the rule in Additional CSS box

Now, let’s go to Appearance->Customize->Additional CSS and put the code above at the bottom of the custom css box:

apply the change to the wordpress link color

As you can see, the moment I pasted the code, the color of the links on the sidebar changed to blue.

You still need to click on publish to make the change permanent.

Conclusion

As you can see, change link color in WordPress is very simple. You still need to understand basic HTML and CSS to do so. If you need assistance, please let me know.

Posted on Leave a comment

WooCommerce Gift Cards – The Ultimate Guide For Store Owner

woocommerce gift card

WooCommerce Gift Cards are a great way to increase your store revenue. As the store owner, you get the cash right away and still don’t have to deliver the goods immediately. In this post, I’m going to show you how to create and use gift cards with WooCommerce so you can use this system on your own store.

Prerequisite

I’m going to use a plugin in this post to create and manage the gift card called YITH WooCommerce Gift Cards. You can get it following this link. You will need the plugin to follow this post.

What are WooCommerce gift cards

Woocommerce gift cards are just WooCommerce products. Customers can buy it as normal products. You can think about them as coupons. Actually, the gift card we are going to create following the method in this post acts exactly like a coupon.

Basic settings of WooCommerce Gift Cards Plugin

The first thing we need to do is to install the plugin from YITH. After installing and activating the plugin,  you’ll see the options as below:

woocommerce gift cards plugin after activated
woocommerce gift cards plugin after activated

Simply click on the link I highlighted, you’ll see the following screen:

woocommerce gift cards plugin general settings

Here, you can set the general settings for gift cards. Here are the most notable and important settings for a gift card (totally my personal opinion):

Do you want to allow the customer to enter a custom amount when purchasing the gift card:

allow manual ammount on the gift card

Normally, stores sell gift cards with fixed amount. However, this plugin allows you, as the store owner to let the customers set their own amount. This offer much flexibility to the customers. She can enter whatever amount she see fit. Here is the option in action:

woocommerce gift card with custom amount

As you can see, it’s very convenient and rest assured that there isn’t any problem to you to manage this situation.

Allow customers to send the gift card at a later date

send the gift card at a later date

This is an interesting option. For example, the customer wants to buy a gift card for a friend as a birthday gift. However, the friend’s birthday is a day in the future and the customer doesn’t want to forget to send the card on that day. If you enable this option, the customer can specify the day she wants to send the card and the email of the recipients. After making the purchase, she can rest assured that the gift cards are delivered to the recipients on the day she requested.

Allow customers to purchase multiple gift cards at once

allow multiple recipients of the gift cards

Enable this option only increase your customers’ convenience and your revenue. With this option, the customers can buy and send the gift card to multiple contacts. For example, she buys 3 gift cards and send to 3 friends, you’ll make a sales of 3 gift cards.

Enable gift this product option

enable gift this product option on woocommerce products

Instead of entering an amount, the customer can use “Gift this product” option to create a gift card with the amount matches the price of the product. By default the button is available on all products’ pages.

WooCommerce Gift Cards - The Ultimate Guide For Store Owner 2

How to create WooCommerce gift cards so customers can purchase

There are some more options in the plugin’s settings. However, I’ll let you explore that section. If you have questions, please let me know in the comment section. Now, we are going to create some gift cards with fixed amount on our test site.

If you have the plugin installed and activated, you’ll see this option:

gift card option in dashboard

However, don’t go there yet. If you remember, I mentioned that a gift card is just a normal product. Let’s go to Products->Add new to add a new gift card.

create-woocommerce-gift-card-using-plugin

As you can see, the interface is very familiar. You’ll need to enter the gift card name and description as usual. However, when you change the product type to gift card, the options on the right changed.

You can enter as many value as you want in the gift card amount box and hit enter to add that amount. If you don’t want a particular amount, simply click on the x icon on that amount below the “Gift card amount” box.

Now, let’s publish the gift card and see it live.

woocommerce gift card created with plugin

As you can see, the gift cards has all options as we specified. If the customers need another amount which isn’t in the list, she can select manual amount and enter her desired number.

Testing the WooCommerce gift cards in action

Now it’s time to test the gift card and see if it’s working as intended. I’ll buy a gift card and then redeem the card on a different purchase.

First, let’s go to the gift card page:

buy a gift card on store

As you can see, I’m buying this gift card for my imaginary friend: Ron. I selected the 500 option then enter additional details and click on add to cart as I do when purchasing a normal product.

Now, let’s check the cart:

gift card in card page

As you can see, you can even use coupon code on this purchase. Since I don’t have the coupon code, I’ll go ahead and complete the checkout.

After completing the purchase, I’ll get the details here:

woocommerce gift card order details

You can see that, we have the section called gift card code. This is the code you can use to redeem the purchase. Let’s go to the store in a different browser and try to redeem the gift card code.

I’m going to buy some items as below. As you can see, the amount of the order is 268 pound:

buy test order on woocommerce

On the checkout page, similar to coupons, I can enter the gift card (This option is available thanks to the plugin):

apply gift card code on checkout page

After entering the gift card code and hit apply gift card, the total is changed:

woocommerce gift card successfully applied

Since the gift card amount is 500, the order is covered by the gift card. The amount I have to pay is 0.

Let’s complete the checkout.

checkout complete using the gift card

Let’s go to the site dashboard, click on Gift cards->all gift cards:

list of gift cards in woocommerce

As you can see, the first one is the one we have used. The balance now is £232 since we have applied it for an order with an amount £268.

Conclusion

As you can see, setting up WooCommerce gift cards is quite simply with the help of YITH WooCommerce Gift cards plugin. There are more options I didn’t cover in this post such as set expiration date for the gift cards, manually generate the gift card or set a format for the gift card. I personally think this plugin can cover all kind of needs regarding creating gift cards for your WooCommerce store. If you have any questions, please let me know. You can find out more about the plugin or make purchase of the plugin by clicking here.

Posted on 1 Comment

WooCommerce Featured Products Ultimate Guide

WooCommerce Featured Products Ultimate Guide 3

One of the best way to setup a collection of rock-star products in WooCommerce is to set them as featured product. WooCommerce featured products are not different from regular products in terms of features, shipping, functionalities. Any product can be a featured in WooCommerce and the decision is totally up to you (it’s different from best selling products, which are determined by your customers). In this post, I’m going to show you:

  1. Three ways to make a product as featured product
  2. How to remove a product from being a featured product
  3. How can you display the featured products via shortcode
  4. What is the best way to display featured products in a slider

Sounds cool? Let’s get started.

Three ways to make a featured product in WooCommerce

Mark a product as featured product in Products list

The first way to make a product as featured product in WooCommerce is to go to Products->All products:

WooCommerce Featured Products Ultimate Guide 4

Most of the time, you can see the column without a title but stars. That’s the featured column. Simply click on the start to mark it as featured product.

When you click on the star, the blank star will be filled and the filled star will be blank:

WooCommerce Featured Products Ultimate Guide 5

As you can see, it takes a moment for the status to update since the page need to reload. That’s the quickest way to mark a product as featured product or not.

Oh, I don’t see the stars column!!!

If you don’t see that column (with the stars), simply click on Screen Options button (at the top right of your screen corner) and check the box says Featured:

WooCommerce Featured Products Ultimate Guide 6

Make sure you hit the apply button to see the changes.

Mark a product as featured product in Quick Edit

The second way to make a product become featured product is through the quick edit menu. Under every product, you will see the Quick Edit link at the right of Edit link. Click on that and you’ll see this:

WooCommerce Featured Products Ultimate Guide 7

Simply click on the Featured checkbox to make it featured product. Uncheck it to remove it from featured products.

Mark product as WooCommerce featured product in product’s edit page

The third and final way to make a product featured product is through its edit page.

In the product Edit page (you get to this page either by click the Edit link under the product in Products page or the Edit product option at the top of the product page), look at the top right (in the Publish box), there is an option called Catalog visibility:

WooCommerce Featured Products Ultimate Guide 8

Let’s click on the Edit link under Catalog visibility, you’ll see this:

WooCommerce Featured Products Ultimate Guide 9

Well, you probably know what to do next. Simply check the box says: This is a featured product and then click OK.

Display featured products anywhere with WooCommerce shortcode

WooCommerce has as dedicated shortcode for showing featured products, that is: [featured_product]

Display all features products

To display the list of featured products, you can use the shortcode below:

[featured_products limit="4" columns="2"]

What this shortcode does is it will show 4 products in two columns and products are featured products.

Display features products and specify the number of columns

Now, if you want to increase or decrease the number of featured products per row, simply modify the number in the columns field.

For example, you can display all WooCommerce featured products available in your store in 3 columns, you can use the shortcode below:

[featured_products columns="3"]

Simply removing the limit field make the shortcodes display all products.

WooCommerce Featured Products Ultimate Guide 10

Display WooCommerce featured products in specific categories

If you want to display the featured products in particular categories only, use category attribute:

[featured_products category="ssd,business-pc"]

As you can see, you can include more than one category by separating them with comma.

Where to place this shortcode? You might ask? You can put this shortcode anywhere in your pages/posts.

Display featured products in sidebar

With the shortcode, you can display any kind of products anywhere, including in the sidebar. So, I’m going to use the shortcode above (three products, no limit) to put on my sidebar.

Let’s go to Appearance->Widget and drag in a text widget and paste the shortcode in:

display featured products in a sidebar

Now, if I go and view my website, I’ll see the featured products on the sidebar. Since the sidebar is narrow, there is only one product per line and all the products stack one each other to form a very tall column:

woocommerce featured products in the sidebar

At this point, you may wonder if we can display the featured product in a slider so the user can swipe left and right without scrolling very long. Well, of course we can. However, we need a plugin for that. Fortunately, I’ve made a plugin to help you display not just the featured products but all kind of WooCommerce products in a slider. You can checkout the WooCommerce Slider Plugin here

Conclusion

WooCommerce featured products can offer some flexibility to the way you show your products to your visitors. The good thing about the featured products is you can control what products are featured, unlike best selling products. Using featured products right can increase sales for your store. If you have questions related to this topic, don’t hesitate to leave a comment below.

Posted on Leave a comment

[Fixed] Why Does Yoast Not Generate A Sitemap – Sitemap_index.xml 404

[Fixed] Why Does Yoast Not Generate A Sitemap - Sitemap_index.xml 404 11

So I have been struggling to fix a problem with my sitemap. It was working properly before, until I moved the server.

The problem is I didn’t know up until this morning. I moved my site to the new server two weeks ago.

And Google noticed that too:

sitemap-404 error

That doesn’t look good, does it?

So I, like you guys right now, search the web for a solution. I was running Rankmath. I tried to change to Yoast SEO and other sitemap plugins but still the 404 error persisted.

By the way, my site is on an Nginx server.

Yoast SEO  has a post here showing the solution or half of the solution. They provided the code below but didn’t tell where to put the code:

location ~ ([^/]*)sitemap(.*).x(m|s)l$ {
  ## this rewrites sitemap.xml to /sitemap_index.xml
  rewrite ^/sitemap.xml$ /sitemap_index.xml permanent;
  ## this makes the XML sitemaps work
  rewrite ^/([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 last;
  rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
  rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
  ## The following lines are optional for the premium extensions
  ## News SEO
  rewrite ^/news-sitemap.xml$ /index.php?sitemap=wpseo_news last;
  ## Local SEO
  rewrite ^/locations.kml$ /index.php?sitemap=wpseo_local_kml last;
  rewrite ^/geo-sitemap.xml$ /index.php?sitemap=wpseo_local last;
  ## Video SEO
  rewrite ^/video-sitemap.xsl$ /index.php?xsl=video last;
}

I put it in the server block, didn’t work.

Then I tried to put this inside the location / block inside the server block and the problem was solved.

nginx configuration to fix sitemap 404 error

Remember to put the configuration block inside location /

And that’s all the fix needed to make your sitemap.xml working again.

 

Posted on 6 Comments

The Ultimate Guide To WooCommerce Grouped Products

The Ultimate Guide To WooCommerce Grouped Products 12

Alongside simple product, variable and affiliate product, grouped product is one of the four default product type of WooCommerce. Knowing how to use WooCommerce grouped product can help you deliver much more flexible product choices for your customers. In this post, let’s discover what WooCommerce Grouped product is and how it can help you grow your store.

What is WooCommerce grouped product?

Grouped product, as its name suggest, is a product that consists of a group of other products. You can think of WooCommerce grouped product as a container of other WooCommerce products. In real life, you see grouped products under the name of combo, set… For example, a BBQ combo may have one dish or tuna, two beer and two dishes of beef. Those individual can be sold individually. However, the guys at the marketing department may suggest that we create these combos to improve sales for our stores.

Why do you want to use WooCommerce grouped product instead of simple product

One good reason to use WooCommerce grouped product is to increase sales of more than one single item as mentioned above. Another good use case of group product is to sell products that usually go together. Computer set is an example. Many times people buy individual parts like monitor, keyboard, mouse… However, the people are very frequently shop for computer set instead of shopping individually.

How to create a WooCommerce grouped product

Creating a grouped product is very simple, especially with WooCommerce. Here are the steps to create a simple WooCommerce grouped product. Let’s go ahead and create a computer set:

First, let’s go to Products -> Add new

create a grouped product in woocommerce

Now, when you change the product type to Grouped product, you will see the field for price and sale price disappear! Don’t freak out. It makes sense since the price of the grouped product is the combination of its children’s price. You will also see the shipping tab disappear for the same reason.

Other than that, you will see that WooCommerce grouped product is similar to simple product. You can enter short description, long description, adding products feature images, gallery images as usual.

enter details for grouped product

After entering all the needed data, it’s time to publish the grouped product and have a look at its product page:

woocommerce grouped product

You may notice that there isn’t an add to cart button. The reason is simple. There isn’t anything to purchase yet. The next step is to add child products to this grouped product.

How to add single products into  a grouped product

Adding single products to a grouped products is simple. You need to make sure that you have all the individual products ready first. In this example, I have four simple products ready to add as below:

simple products in a grouped product

Now, let’s go to our newly created WooCommerce grouped product, then scroll down, click on Product data tab if it hasn’t been expanded already. Finally, click on Linked product:

adding simple products to grouped products - step 1

Now, let’s click on the Grouped products input box and start typing the product name. You will see the suggestions as you type:

adding simple products to grouped products - type suggestions

As you can see, as I typed UHD, the suggestion for the screen appear. Just click on the result to have it added to the WooCommerce grouped product.

After add all the products to the grouped product, you will see it appears like this:

adding simple products to grouped products - step 3

Hit the update button and let’s see the grouped product page:

woocommerce grouped product with child products

As you can see that, all child products are listed here. For the customer, he just need to enter the number of items per child product and begin to check out.

But wait!

Isn’t it silly to make the customer enter the number of parts when most of the time, the number should be 1?

You only need

  • one monitor
  • one keyboard
  • one case

per computer.

Well, if you ever wonder the same thing, you may want a different type of product called product bundle.

Use variable product in WooCommerce grouped product

At this point, you now how to create a grouped product and add single child products to that grouped product. You may wonder, can you add variable products to the grouped product instead of simple products? The answer is yes. However, without using any plugin, you may end up with something like this:

variable product inside grouped product

When you click on the select options button, you will get the that variable product page and you add the product to cart from that variable product’s page.

I’m not sure about you but that flow is not convenient for the customer.

So, it’s definitely possible to use variable product inside grouped product. However, in my personal opinion, it is not very convenient for your customers to go to extra steps to add the product to cart.

Ordering child products inside WooCommerce grouped product

In my example, you can see that the Samsung monitor is listed first then the case, then the keyboard and finally the mouse. You may wonder, how does WooCommerce sort these products and how can  you change their order?

For example, I want to list the mouse first, then the keyboard, then the monitor and finally the case, how can I do that?

It actually very simple.

Now, go to our grouped product and go to Product Data->Linked products:

You’ll notice the child products are in a list. You maybe surprised to find that every items on that list is draggable!

So, let’s re-arrange our child products:

The Ultimate Guide To WooCommerce Grouped Products 13

After clicking on update product, I can see the product page with new ordering:

new products order in woocommerce grouped products

Show images for single products

At this point, your WooCommerce grouped product is looking good. However, you may notice that individual products in the grouped product don’t have product’s image. What if you want to add the products’ thumbnail just before the product name?

It’s time to add some code. You know where to put the custom code? In a child theme, of course. You must remember to add additional code in a child theme. You don’t know what a child theme is? Check out my ultimate guide to child theme in WordPress. Don’t worry, it’s short.

Now, let’s enter the following code at the end of your child theme functions.php file:

add_action( 'woocommerce_grouped_product_list_before_label', 'bc_woocommerce_grouped_product_thumbnail' );

function bc_woocommerce_grouped_product_thumbnail( $product ) {
    $attachment_url = wp_get_attachment_image_src($product->get_image_id(), 'thumbnail', false)[0];
    ?>
    <td class="label">
        <img src="<?php echo $attachment_url; ?>" />
    </td>
    <?php
}

Then save the file. Now, if you view the WooCommerce grouped product page, you’ll see this:

display single product thumbnail in grouped product with woocommerce

It looks better, doesn’t it?

Now, what if you want to display the thumbnail before the quantity box?

No problem, let’s replace the old code with this one:

add_action( 'woocommerce_grouped_product_list_before_quantity', 'bc_woocommerce_grouped_product_thumbnail' );

function bc_woocommerce_grouped_product_thumbnail( $product ) {
    $attachment_url = wp_get_attachment_image_src($product->get_image_id(), 'thumbnail', false)[0];
    ?>
    <td class="label">
        <img src="<?php echo $attachment_url; ?>" />
    </td>
    <?php
}

The only change is the part after add_action. In the previous code, the text right after the opening ( is ‘woocommerce_grouped_product_list_before_label’. Now it is: ‘woocommerce_grouped_product_list_before_quantity’

As you can guess, the thumbnail is now at the beginning of the row:

product image before quantity box in woocommerce grouped product

Conclusion

I hope you feel more comfortable with grouped product now. Grouped product is great for grouping simple products together in WooCommerce. You can use variable products in WooCommerce grouped products. However, due to the inconvenient checkout flow as shown above, I would suggest you use simple products only. You can also search for a plugin that  let you select the variable product right on the grouped product page. Doing so will greatly improve the customers’ experience on your website.