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
// resource: | |
// 1. https://www.zyxware.com/articles/5539/solved-cant-connect-to-local-mysql-server-through-socket-var-run-mysqld-mysqld-sock | |
sudo service mysql start | |
or | |
/etc/init.d/mysql start | |
ps -A|grep mysql | |
sudo pkill mysql |
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
// Curl can be used but needs some processing to get the images names in an array. | |
// $data = wp_remote_get('http://www.perfectpartiesusa.com/wp-content/themes/pparties/images/'); | |
// $body = wp_remote_retrieve_body($data); | |
$allProductImages = include "allProductImages.php"; | |
$baselink = 'http://www.perfectpartiesusa.com/images/'; | |
foreach ($allProductImages as $img_slug) { | |
$image_file = file_get_contents($baselink . $img_slug); | |
$put_link = $_SERVER['DOCUMENT_ROOT'].'/store-images/'.$img_slug; | |
file_put_contents($put_link, $image_file); |
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, ADD, PERMIT, AND CHECK A USER TO A GROUP | |
1. adduser username // 'username' is your expected username and follow the prompts to set the new user's information. | |
2. sudo usermod -aG docker ${USER} // 'docker' is group name. If you need to add a user to the docker group that you're not logged in as, declare that username "${USER}" explicitly using. | |
3. su - ${USER} // Use the su command to switch to the new user account. | |
4. id -nG // Confirm that your user is now added to the docker group by typing. It will list all the groups of this user | |
// SEARCH INSTALLED PACKAGES USING KEYWORD | |
dpkg -l | grep -i docker | |
// UNINSTALL A PROGRAM COMPLETELY |
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
# Delete everything and upload new version | |
# resource: https://stackoverflow.com/questions/11071420/delete-everything-and-upload-new-version#11072408 | |
git fetch | |
git merge -s ours origin/master --allow-unrelated-histories | |
git push origin master | |
# ignore remote files and push new files and updates to remote | |
git push --force origin master |
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
sudo chown -R _mysql:wheel /usr/local/mysql/data | |
sudo /usr/local/mysql/support-files/mysql.server restart |
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
/** | |
* get youtube video ID from URL | |
* http://stackoverflow.com/questions/6556559/youtube-api-extract-video-id | |
* @param string $url | |
* @return string Youtube video id or FALSE if none found. | |
*/ | |
function youtube_id_from_url($url) { | |
$pattern = | |
'%^# Match any youtube URL | |
(?:https?://)? # Optional scheme. Either http or https |
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
/* | |
WEBSITE : http://www.oldstructures.com/tag/projects/ | |
*/ | |
/* customer search form for widgets azizultex */ | |
add_filter('widget_text','do_shortcode'); | |
/* search form shortcode that populate tag automatically by tag page */ | |
function searchFormByTag() { |
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
/* | |
WEBSITE : http://www.oldstructures.com/tag/projects/ | |
*/ | |
/* get categories related to tags */ | |
function categoriesbytags_func() { | |
$tag = get_queried_object(); | |
$args = array( | |
'tag' => $tag->slug, |
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
/* | |
You can rewrite custom post type links anyway you want following below code. I have completely replaced CPT slug with a custom metabox field for each post type. | |
Resources: | |
1. http://wordpress.stackexchange.com/questions/83531/custom-post-type-404s-with-rewriting-even-after-resetting-permalinks | |
2. http://shibashake.com/wordpress-theme/custom-post-type-permalinks-part-2 | |
*/ | |
/* Register Custom Post Type */ | |
function viz360_project_post_type() { |
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
Best way to override a plugin function is to use mu-plugins (Must Use Plugins) | |
https://gregrickaby.com/2013/10/create-mu-plugin-for-wordpress/#comment-14420 | |
Aleternatively, follow below : | |
1. Copy the plugin shortcode function and put it anywhere in Child Theme and rename it like custom_cs_user_login_shortcode. | |
2. use 'wp_head' action to remove the plugin shortcode and register the new shortcode again with the new function name like custom_cs_user_login_shortcode. | |
/********************************************* |
NewerOlder