Where are customizer settings stored in db for wordpress theme?

How to clone customizer settings in child theme from parent theme?

The customizer data is stored in table wp_options under option_name theme_mods_THEME-NAME

you can view all such settings via the following query:

SELECT * FROM `wp_options` WHERE `option_name` LIKE "theme_mods_%"

In some cases, you just want to use parent theme’s settings in newly added child theme. If that is your case too, use the following queries to utilize and close those settings for your child theme also.

update `wp_options` set `option_name`="theme_mods_YOURCHILDTHEME_backup" where `option_name`="theme_mods_YOURCHILDTHEME";
insert into `wp_options` (`option_name`,`option_value`,`autoload`) select "theme_mods_YOURCHILDTHEME",`option_value`,"yes" from `wp_options` where `option_name`="theme_mods_PARENTTHEME";

The following one is a bit risky one. If you understand what is going on here, go ahead.

delete from `wp_options` where `option_name`="theme_mods_YOURCHILDTHEME";
insert into `wp_options` (`option_name`,`option_value`,`autoload`) select "theme_mods_YOURCHILDTHEME",`option_value`,"yes" from `wp_options` where `option_name`="theme_mods_PARENTTHEME";

Gravityforms limit submission – once for user, unlimited for guest

	public function context() {

		// rule targets specific user, if this user is different we don't need to test the rule
		if ( $this->user_id != 'all' ) {
			if ( $this->user_id != get_current_user_id() ) {
				return false;
			}
			
		}
		if($this->user_id == "all")
		{
		    if(get_current_user_id()===0)
			{
			    return false;
			}
		}

		return true;
	}

File: gp-limit-submissions/includes/GPLS_Rule_User.php

Plugin: https://gravitywiz.com/documentation/gravity-forms-limit-submissions

How to add Buy Now button on Product page – WordPress/woocommerce?

Change && to &&

add_filter('woocommerce_add_to_cart_redirect', 'malpani_redirect_checkout_add_cart');

        function malpani_redirect_checkout_add_cart()
        {
            if (isset($_POST["buynow"]) && $_POST["buynow"] === "2") {
                return wc_get_checkout_url();
            }

        }

        add_filter('woocommerce_after_add_to_cart_button', 'malpani_add_buy_button');
        function malpani_add_buy_button()
        {
        echo '<input id="buynowinput" name="buynow" value="1" hidden>
            <button type="button" id="buy_now" class="buy_now button">Buy Now</button>
            <script>
                jQuery(document).ready(function ($) {
                    $("#buy_now").click(function (e) {
                        $("#buynowinput").val(2);
                        $(".single_add_to_cart_button").click();
                        e.stopPropagation();
                        e.preventDefault();
                    })
                });
            </script>';

How to get Gravity forms entry value by label?

function harsh_get_value_by_label( $form, $entry, $label ) {
	foreach ( $form['fields'] as $field ) {
		$lead_key = $field->label;
		
		if ( strtolower( $lead_key ) == strtolower( $label ) ) {
			return $entry[ $field->id ];
		}
		if($field->inputs != null and count($field->inputs))
		{
			foreach($field->inputs as $children)
			{
				$subLeadKey = $children["label"];
				if ( strtolower( $subLeadKey ) == strtolower( $label ) ) 
				{
					return $entry[ $children["id"] ];
				}
			}
		}
	}
	return false;
}

How to migrate Customers from Magento2 to WordPress?

Lets break it into 2 parts:

a. Migrate Customer data
b. Migrate Customer Passwords

1) Migrate Customer Data from Magento2 to WordPress

This is rather easy to be honest, there are several plugins for importing data from CSV and then mapping the CSV fields.

My recommended plugin is Customer/Order/Coupon CSV Import Suite by SkyVerge

It basically does everything from customer email to customer address data. It also provides column mapping and custom attribute import for all users. Also comes with multiple configuration options.

Best Free Alternative is https://wordpress.org/plugins/import-users-from-csv-with-meta
But in this one, you can not import magento2 passwords as of v 1.15.0.1
I will update about the solution very soon. So as of now only paid option is there.

2) Migrate Customer Password from Magento2 to WordPress

This wordpress plugin checks and updates passwords of users migrated from Magento2 to WordPress
Plugin Link: https://github.com/harshvardhanmalpani/migrate-password-from-magento2-to-wordpress

Requirements:

  1. user_pass column will have this kind data from Magento2 dcbdc524f215fd054502dcad5a23a702ec029c02ff8d7051d049f76e29927f8b:C8yVqeuPfkHWvkmipx0iKLPtOUGETpLL:1
  2. usermeta table must have a meta_key “migrated_cs” for this user, meta_value can be anything positive
  3. This plugin file password-migrator.php should be in wp-content/plugins and must be an active plugin

What is does?

For new wordpress based users which dont have anything to do with magento2, it doesnt do anything

For all migrated users (those have the key “migrated_cs”), this plugin checks if input password matches old password from magento2 or not, if matched, it clears the key migrated_cs and updates the password using wordpress’ algorithm ; else results false.

Testing Configuration for Paytm Gateway Plugin India

Paytm Payment Gateway Testing Data

Online payment solutions for all your transactions by Paytm Woocommerce Plugin

Download the plugin here: https://github.com/Paytm-Payments/Paytm_Woocommerce_Kit

Enable/Disable
Enable/Disable Enable Paytm Payments.
Title
Title
Paytm
This controls the title which the user sees during checkout.

Description
Description
The best payment gateway provider in India for e-payment through credit card, debit card & netbanking.
This controls the description which the user sees during checkout.

Merchant Identifier
Merchant Identifier
<provided link below>
Merchant Id Provided by Paytm

Secret Key
Secret Key
<provided link below>
Merchant Secret Key Provided by Paytm

Website
Website
WEBSTAGING
Website Name Provided by Paytm

Industry Type
Industry Type
Retail
Industry Type Provided by Paytm

Channel ID
Channel ID
WEB
Channel ID Provided by Paytm

Transaction URL
Transaction URL
https://securegw-stage.paytm.in/theia/processTransaction
Transaction URL Provided by Paytm

Transaction Status Url
Transaction Status Url
https://securegw-stage.paytm.in/merchant-status/getTxnStatus
Transaction Status URL Provided by Paytm

API Keys

You can get your keys here https://dashboard.paytm.com/next/apikeys

API keys are unique credentials issued to every merchant. While MID is used as an identification used for all exchange correspondence, merchant key is used to encrypt every API request to Paytm and decrypt every response from Paytm. Ensure that you keep the merchant key on server side and should not be shared with anyone. In case API keys are compromised, please reach out to our helpdesk to get new API keys.

  • MID (Merchant ID) – Unique identifier issued to every merchant.
  • Merchant Key – This is a unique secret key used for secure encryption of every request. This needs to be kept on server side and should never be shared with anyone.
  • Industry Type ID – This is part of bank and paymode configuration done wrt to an account.
  • Website – This parameter is used to support multiple callback URLs to post the transaction response. Each URL needs to be mapped to a website parameter.

Test API Details are something like this:

  • Test Merchant ID WArHEFXXXXXXXXXXXXXX <–wont work
  • Test Account Secret Key XXXXXXXXOcv1u7P2 <- wont work

Testing Resources / Testing Instruments

Source: https://developer.paytm.com/docs/testing-integration

  • Testing Debit/Credit Card
Card NumberAny Visa or Master Card
Expiration Month & YearAny Future month and Year
CVV123
OTP123123
  • Testing Paytm Wallet Details
Mobile Number77777 77777
PasswordPaytm12345
OTPDoesn’t require 2nd factor authentication489871
  • Testing Netbanking Details
Bank NameAndhra Bank
User IDtest
PasswordTest

Note:
In case you are testing on production environment, use live paymode details to complete the transaction. Once the transaction is successful, you can initiate refund from the dashboard.

Fix Error Too Many Redirects on WordPress Admin page or Blog

There are several cases for the cause and multiple solutions also:

1 Add these 2 lines in wp-config.php file

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';

2 Edit these settings in database directly using PhpMyAdmin in table options or wp_options in option_id, option_name (1,siteurl) and (2,home)

wp_options table

3 You can do the same by Editing wp-config.php and adding these 2 lines

define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');

4 Fix your .htaccess file with default one
Check here for default .htaccess for wordpress

Top CMS out there in 2018.

CMS:

A content management system is a software that helps us to manage our content and site.

You can literally manage everything from a blog to an e-commerce site, using CMS. You can manage an article if you have a blog, or manage your product if it is an e-commerce business.

It has made our life so easier that we just can’t imagine having a site without CMS. You can operate most CMS out there even if you have no prior technical knowledge.

Today we are going to talk about the top CMS in 2018, there features, flexibility and specifications because that’s what they are known for.

So, without any further delay let’s begin.

Top CMS:

  1. WordPress: This one goes without saying. Probably the best one out there. WordPress can make almost any kind of site either it is a blog, a real state site or an e-commerce. It can make anything under the sun. WordPress is the framework behind many of the websites and blogs you visit every day, including this one. .org Few of the key features are responsive design, social sharing features, multiple page styles, auto upgrade, and standard compliant coding. The one thing that makes it a CMS beast is plugins.
  2. Joomla: Joomla is a popular Content Management System. It is much more than just a powerful content management system. Besides, hundreds of extensions to enhance the functionality of any Joomla website, Joomla itself includes some powerful built-in features (or core features). Many times ranked as the 2nd best CMS after WP. zoomla Few key features are Rss, media manager, web links, search, banner management and, user management.
  3. Drupal: Drupal 8 takes an already terrific content management framework to ever greater heights for users, administrators, and developers. There’s a seriously sharp focus on user-friendliness, but the content presentation, new ways to create data structures, build APIs, multilingual capabilities, and the delivery of mobile accessibility out of the box? Drupal 8 brings those to the table too.  Few of the features are mobile first, multilingual ready, loading speed, javascript automated testing.
  4. Magento: Specific to make an e-commerce site. The large array of features is one of the main benefits of Magento. Through them, you can easily develop and manage a successful online store. Magento features like different payment engines and shipping options along with the international support and high security using an  SSL certificate will make your shop an attractive place for e-commerce.  The core features are checkout payment and shipping, analytics and reporting, marketing and promotional tools, and order management.
  5. OpenCart: OpenCart is an open-source shopping cart built on PHP/MySQL code. Distributed as a free eCommerce solution, OpenCart is a very user-friendly and effective platform that comes with a very intuitive and well-designed user-interface as well as a higher selection of extensions. Perfect for small businesses and medium-sized e-commerce stores, OpenCart is loaded with all the basic functions a user would need from an e-commerce solution.  Main features are, Product Reviews, Product Ratings, open source, multi-currency, automated image resize, 20+ payment gateways, and 8+ shipping methods.

One honorable mention is WIX. Very user-friendly having drag and drop interface.

SO, these were the top of 2018 CMS. You should choose one according to your needs.  Keep visiting for such more articles.

Thank You.

WordPress.com v/s WordPress.org : The difference.

WordPress:

The most popular CMS, yet there is one thing that keeps on confusing the newbies. And that is the difference between wordpress.com and wordpress.org.

I myself have been confused about the difference, which once made me choose the wrong one. (as per my needs.)

But I don’t want this to happen with you, hence here is an article to clear this thing out.

What’s the difference:

The very first difference is in the domain extension.

.org – organization (free for everyone)

.com – commercial.

This isn’t a hard and fixed rule, but you got the context.

The major difference:

The major difference is “who is hosting your site?” In wordpress.com your site is hosted by WordPress, whereas in wordpress.org you are hosting your site via a hosting provider.

WordPress.org

The WordPress software, located at WordPress.org, is a free, open source content management system. To use the WordPress.org software, you need to install it on a web server. And that’s the key difference between WordPress.com vs WordPress.org.

If you download WordPress from WordPress.org, YOU host it. You set it up with your own hosting provider and use it on your own website, which gives you a ton of flexibility. This is why WordPress.org is often also called self-hosted WordPress.

.org

WordPress.org has much better customization options. You’re able to install plugins, use custom website themes, and do just about anything you want with your site. You can also monetize your website however you want, which is great if you’re planning to make it a business.

WordPress.com

WordPress software located at wordpress.com is a blog website platform. This doesn’t need to be downloaded. You can have your site running right away just by signing up on the wordpress.com.

This is limited but free as long as you are ok with their branding. And if you want to the domain of your choice, pay for it. No plugin is allowed with a free version.

.com

With .com you won’t be able to install your own “plugins” or “themes” unless you pay for the expensive business plan. Plugins and themes are one of the most helpful things about the WordPress software because they make it easy to customize your site, so that’s a pretty big loss.

The final note:

Go with wordpress.org, if you want the best options and full control over your site.

I hope this was helpful to you. Thanks for reading.

Thank You

Default .htaccess file for wordpress with compression and caching tweaks

Here is the default .htaccess file for wordpress

If you are using cpanel, before you proceed make sure that you don’t have htaccess file already. Default File Manager settings in cpanel make it hidden

Default Settings in cPanel File Manager

.htaccess file – default code for wordpress

# BEGIN WordPress
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</ifmodule>
# END WordPress

If your WordPress Installation is inside a directory say knowledge, which means your wordpress url is https://abcd.com/knowledge/ then htaccess code would be

# BEGIN WordPress
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /knowledge/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /knowledge/index.php [L]
</ifmodule>
# END WordPress

Add the following code for Leverage Browser Caching

<ifmodule mod_expires.c>
ExpiresActive On
</ifmodule>

# Images
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"

# Video
ExpiresByType video/mp4 "access plus 1 year"
ExpiresByType video/mpeg "access plus 1 year"

# CSS, JavaScript
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"

# Others
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"

Add the following code for GZip Compression

<ifmodule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
</ifmodule>

# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent