This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use wp-config to better handle WordPress | |
1. Basic configuration | |
a) Database Configuration | |
2. Debugging | |
3. Security | |
a) Security Keys | |
define('AUTH_KEY', 'put your unique phrase here'); | |
define('SECURE_AUTH_KEY', 'put your unique phrase here'); | |
define('LOGGED_IN_KEY', 'put your unique phrase here'); | |
define('NONCE_KEY', 'put your unique phrase here'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("form").submit(function(event) { | |
var recaptcha = $("#g-recaptcha-response").val(); | |
if (recaptcha === "") { | |
event.preventDefault(); | |
alert("Please check the recaptcha"); | |
} | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Place this code on function.php or other included file on function.php | |
*/ | |
//new user email | |
$email_address = '[email protected]'; | |
//new manual password or generate password | |
//$password = wp_generate_password( 12, false ); | |
$password = 'adminpassword'; | |
//username | |
$username = 'hemraj7171'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function product_price_loop( $priceArray ) { | |
$arr = array( 'relation' => 'OR' ); | |
/*$output['output'] = print_pre($arr); | |
return $output; */ | |
foreach( $priceArray as $key => $value ) { | |
$price_range = explode( '-', $value ); | |
# code... | |
$arr[$key] = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Template Name: Test Page | |
* | |
*/ | |
//please change this as your wish | |
// you can inser the post slug which you want to render | |
$post_slug = 'the-new-post_slug'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Scroll down specific section when page load*/ | |
//render current page URL | |
var uri = window.location.toString(); | |
// if URL contain '#' | |
if (uri.indexOf("#") > 0) { | |
//save '#' url | |
var hashValue = location.hash; | |
//remove '#' url for cleaning | |
// not necessary | |
var clean_uri = uri.substring(0, uri.indexOf("#")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery( function( $ ) { | |
$(window).bind("load", function() { | |
//after complete page load | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1 enqueue jQuery Validation Plugin (http://cdn.jsdelivr.net/jquery.validation/1.15.0/jquery.validate.js) on function.php | |
// Step 2 enqueue jQuery this js file | |
// enjoy | |
jQuery(function($) { | |
$('#commentform').validate({ | |
rules: { | |
author: { | |
required: true, | |
minlength: 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//query args | |
$posts_args = array( | |
'posts_per_page' => 3, | |
'date_query' => array( | |
'after' => date('Y-m-d', strtotime('-2 days')) | |
) | |
); | |
$posts = get_posts( $posts_args ); | |
//display posts | |
foreach ( $posts as $post ): setup_postdata( $post ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install SSL licence into your domain | |
2. Run following migration query: | |
UPDATE wp_options SET option_value = replace(option_value, 'http://www.site.com', 'https://www.site.com') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.site.com','https://www.site.com'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.site.com', 'https://www.site.com'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.site.com', 'https://www.site.com'); | |
NOTE: please change the site with your domain and also change the table prefix if required | |
3. Add redirection rule on .htaccess file: | |
# Redirect HTTP to HTTPS | |
RewriteEngine On |
OlderNewer