This file contains 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: Create shortcode | |
function njengah_add_login_shortcode() { | |
add_shortcode( 'jay-login-form', 'njengah_login_form_shortcode' ); | |
} | |
//Step 2: Shortcode callback | |
function njengah_login_form_shortcode() { | |
if (is_user_logged_in()) | |
return '<p>Welcome. You are logged in!</p>'; ?> | |
<div class ="njengah-login-tutorial" > | |
<?php return wp_login_form( |
This file contains 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
server { | |
# Redirect yoursite.com to www.yoursite.com | |
server_name yoursite.com; | |
rewrite ^(.*) http://www.yoursite.com$1 permanent; | |
} | |
server { | |
# Tell nginx to handle requests for the www.yoursite.com domain | |
server_name www.yoursite.com; |
This file contains 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
<h3>Recent Comments</h3> | |
<ul class="recent-comment"> | |
<?php | |
$comments =get_comments( array('number'=>'5', 'status' => 'approve') ); | |
foreach($comments as $comm) : | |
$url = '<a href="'. get_permalink($comm->comment_post_ID).'#comment-'.$comm->comment_ID .'" title="'.$comm->comment_author .' | '.get_the_title($comm->comment_post_ID).'">' . $comm->comment_author . '</a>'; | |
?> | |
<li> | |
<?php echo get_avatar($comm->comment_author_email, 30); ?> | |
<strong><?php echo $url; ?></strong> |
This file contains 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
#add this to functions.php | |
function _remove_query_strings_1( $src ){ | |
$rqs = explode( '?ver', $src ); | |
return $rqs[0]; | |
} | |
if ( is_admin() ) { | |
// Remove query strings from static resources disabled in admin | |
} | |
else { |
This file contains 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
#If you installed / updated / changed anything on live server then this might be helpful! | |
#test nginx | |
sudo nginx -t | |
#restart nginx, mysql & php7.0-fpm | |
sudo systemctl reload nginx | |
sudo service mysql restart | |
systemctl restart php7.0-fpm.service |
This file contains 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
#I Recommend | |
sudo find . -type d -exec chmod 755 {} \; #for all directories | |
sudo find . -type f -exec chmod 644 {} \; #for all files | |
sudo chmod 444 wp-config.php #change permission for this file only! | |
# For nginx users /var/www/html/ | |
sudo chmod 444 wp-config.php | |
sudo chmod 444 nginx.conf |
This file contains 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
/* When moving sites from one location to another, it is sometimes necessary to manually modify data in the database to make the new site URL information to be recognized properly. Many tools exist to assist with this, but generally I use this method */ | |
-- Login to MySQL | |
use database; | |
show tables; | |
SELECT * | |
-> FROM `wp_options` | |
-> LIMIT 0 , 30; | |
update wp_options set option_value = 'http://example.com OR http://Server_IP' where option_id = 1; -- Most important to pick correct option_id for change "siteurl" option_value | |
update wp_options set option_value = 'http://example.com OR http://Server_IP' where option_id = 1; -- Use this command again to change "home" option_value | |
EXIT |
This file contains 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
/* A common use of mysqldump is for making a backup of an entire database: */ | |
CREATE DATABASE database-name DEFAULT CHARACTER SET utf8 COLLATE utf8_uni code_ci; -- Create new DB if you don't have it. | |
GRANT ALL ON database-name.* TO 'user-name'@'localhost' IDENTIFIED BY 'user-password'; -- Give permission to access your created DB. | |
use database-name; | |
source path/file.sql; |
This file contains 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
CREATE DATABASE database-name DEFAULT CHARACTER SET utf8 COLLATE utf8_uni code_ci; | |
GRANT ALL ON database-name.* TO 'user-name'@'localhost' IDENTIFIED BY 'user-password'; | |
use database-name; | |
source path/file.sql; |