How to keep social share counts after migrating to SSL

When you migrated your website to SSL protocol (from http to https), you probably noticed that you had lost all your previous share counts. How to keep them?

We can think on different approaches for them.

Main point: Unfortunately it is not possible via social networks APIs themselves. That’s why we need some tricks.

Here is how i solved this problem and retained back to my old posts’ social share counts.

I am using custom embed codes for social share buttons. Here is facebook embed code i am using:

Now we need to apply our trick and to retain old share counts.

Here is the logic:
1. We remember the date we migrated to SSL.
2. We check if current post was published before or after that date.
3. If it is published before that date, we pass Facebook our URL with HTTP version, in order to save old share counts.

That’s all.
I have migrated to SSL at 20th May, 2018. That’s why i check if post_date is greater or less than 2018-05-20 06:30:03, if it is less, then i change HTTPS to HTTP.

 

Before:

After:

It is possible to apply same logic to other social network embed codes.

WordPress Search – Redirect plural search terms to singular ones

Today I am sharing quick gist which can redirect plural search terms to the results with singular search terms.
Here is when it can be useful:
Let’s say you have some article/page/product which contains the word “e-book”. But your visitor enters your website and searches for the term “e-books”. By default search algorithm he/she will get “not found” message. Continue reading “WordPress Search – Redirect plural search terms to singular ones”

Random user agents for WordPress Remote Requests

wordpress remote requests

wp_remote_get() and wp_remote_post() functions helps us to fetch data from external source: grabbing websites, getting data from public sources, API’s etc.

Sometimes using default headers causes suspect at external side. Too often requests can cause asking a captcha, or blocking your IP.

To escape from such problems we need to insert real visitor like user agents to our requests. And not only one, but randomly chosen ones.

Here is sample code for WordPress

Continue reading “Random user agents for WordPress Remote Requests”

Make your WooCommerce search smarter and increase your conversions & sales

Plugin Description

Most WooCommerce store owners just ignores their website’s search section and lose a lot of potential customers due to this. That’s why they keep their theme’s poor search module unchanged. Or in best case they use simple live ajax search, which is not much effective and which is really slow.(in each simple typing a website sends request to server, then server processes the query and returns the needed results)

But E-Commerce search module should be fast, smart, effective and interactive. It should be some kind of bot-assistant which offers your products to customers with all possible ways. It doesn’t matter what they types – search module should recognize their typed words, analyize it, correct it if there is any misspelling and finally suggest related products.
Even if there is no any related product, it should offer some popular items in website – may be a visitor would like to purchase.

WooCommerce Search Box plugin does exactly so. It has unique search algorythm which works at both front-end and backend sides.
When user types something – related products appear lightning fast, without ajax server request. Everything works so fast.


And then, if the visitor makes a typo misspelling, the plugin recognizes it with similarity algorithm and gives the results for auto-corrected keyword.
What happens when a visitor presses enter and leaves the window with live search suggestions. Backend search results comes from theme’s backend code, that’s why it is not smart and it can not show same smart results which was available in live suggestions box. And that would be bad. That’s why WooCommerce Search Box filters backend results with WordPress hooks and forces website to show same smart results with live suggestions box, which is really great.

Or what if a visitor types synonym word instead of the one in product name? (for example, a visitor can type bike instead of bicycle.) You see, there are so many cases where we lose potential customers and their purchases via poor search results. That’s why e-commerce search module should be as much better as it is possible.

Features

  • Same smart search results at live front-end and back-end sides.
  • Typo correction – showing products by auto-corrected keyword if there is a misspelling.
  • Search by Stock Keeping Unit (SKU).
  • Search by custom fields, attributes and description alongside with product title.
  • String Multi-Sequence Checker (It checks all possible combinations of typed keywords).
  • Featured Products at start window.
  • Some custom helper or welcome message at start window.
  • Suggested some popular products when “no results found” appears.
  • Personalized “last visited” products block.
  • Search by similar, synonym words.
  • Search Analytics Admin Page – which collects search keywords and shows useful data charts.
  • Search by Product Category.
  • Supporting all languages and UTF-8.
  • Converting special letters (f.e. é,ç) if a visitor typed similar ones (f.e. e,c)
  • Showing correct prices after all possible active taxes or just without taxes.

Download WooCommerce Smart Search Plugin now

Amazon like Last Visited Products for WooCommerce

2 days ago we, Totheme Labs team released new plugin for WooCommerce, called “Recently Viewed Products for WooCommerce”.

It is beautiful product history plugin for WooCommerce. Shop owner can create separated page, widget, footer popups to display this data to his customers.

Once it is activated, it collects the customer visit data, and shows his history as beautiful charts.

The solution would be useful for shop owners who want to increase sales at their WooCommerce Store.

For example, Amazon.com has been successfully used similar module  in the latest several years.

Amazon.com recently viewed products module.

So if you are WooCommerce shop owner, you can easily get similar solution for your web store.

Get the plugin now

What’s new in WordPress 4.7?

As we know WordPress 4.7 was released at 6th December, 2016.
In official website they listed all news and changes in the new version.

I would like to list the most important ones for developer side:

WordPress 4.7 release

  • New TwentySeventeen theme:  It is really really great theme for bloggers. As you see, i have already switched to this theme in my blog. It is clean, really mobile friendly, fast. And it has very beautiful fonts included. It also has custom CSS field which is very important for customizing. It is the first WordPress theme which i liked since TwentyTen.
  • Yet another global variable death – now we can use get_bloginfo( ‘version’ ) instead of global $wp_version variable.
  • REST API Content Endpoints – From version to version WordPress becomes more suitable for 3rd party app development.  In latest version WordPress comes with REST API endpoints for posts, comments, terms, users, meta, and settings.
  • New theme API function:  get_theme_file_uri().  Now we can use get_theme_file_uri (‘js/file.js’) instead of get_template_directory_uri().’js/file.js’
  • Page Templates for Post Types – now you can create default templates for custom post types just with adding Template Post Type: custom_post_type to the file head commented area.
  • Custom Bulk Action – It is also really useful feature. Before to add custom bulk action option we had to use own non-standard ways. Now it has native support.

That’s all new important  changes for me.

Create temporary WordPress nonce

May be the title sounds a little contradictious, as WordPress nonces are not storable data, so they don’t need to be expired. They are just hashed functions which are used for anti-CSRF purposes.
But for some special cases we may need to make nonce “to be expired”.

I mean, at first request it should work, after second request it should return false. Or it should work this day, since tomorrow it should return invalid.

This operation smells anti-bruteforce attempt, rather than anti-CSRF. Because anti-CSRF technology doesn’t have any relation with time and expiration.

So, our aim is to create a form which works only one time or temporary. This solution may be useful when we do ajax requests which should run only at once via setTimeout. So after
Let’s do that. (i write sample for ajax nonces. But same method can be used with input, url nonces too.)