#Adding an existing project to GitHub using the command line
Simple steps to add existing project to Github.
In Terminal, change the current working directory to your local project.
##2. Initialize the local directory as a Git repository.
git init
| # Bulk update all product posts with a post status of publish to draft | |
| wp post list --field=ID --post_type=product --posts_per_page=500 --post_status=publish | xargs wp post update --post_status=draft | |
| # Bulk update all product posts with a post status of draft to publish | |
| wp post list --field=ID --post_type=product --posts_per_page=500 --post_status=draft | xargs wp post update --post_status=publish |
| UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
| UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); | |
| UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); | |
| UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl'); |
| <?php | |
| /** | |
| * Validates a given latitude $lat | |
| * | |
| * @param float|int|string $lat Latitude | |
| * @return bool `true` if $lat is valid, `false` if not | |
| */ | |
| function validateLatitude($lat) { | |
| return preg_match('/^(\+|-)?(?:90(?:(?:\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\.[0-9]{1,6})?))$/', $lat); |
| <?php | |
| add_filter('acf/settings/save_json', 'cnmd_set_acf_json_save_folder'); | |
| add_filter('acf/settings/load_json', 'cnmd_add_acf_json_load_folder'); | |
| /** | |
| * Set a new location to save ACF field group JSON | |
| * | |
| * @param string $path | |
| * @return string | |
| */ |
| <?php | |
| function json_response($code = 200, $message = null) | |
| { | |
| // clear the old headers | |
| header_remove(); | |
| // set the actual code | |
| http_response_code($code); | |
| // set the header to make sure cache is forced | |
| header("Cache-Control: no-transform,public,max-age=300,s-maxage=900"); |
| afghanistan : Afghanistan | |
| albania : Albania | |
| algeria : Algeria | |
| american_samoa : American Samoa | |
| andorra : Andorra | |
| angola : Angola | |
| anguilla : Anguilla | |
| antigua_and_barbuda : Antigua and Barbuda | |
| argentina : Argentina | |
| armenia : Armenia |
| function wp_api_encode_acf($data,$post,$context){ | |
| $data['meta'] = array_merge($data['meta'],get_fields($post['ID'])); | |
| return $data; | |
| } | |
| if( function_exists('get_fields') ){ | |
| add_filter('json_prepare_post', 'wp_api_encode_acf', 10, 3); | |
| } |
| <?php | |
| /** Example taken from http://www.webgeekly.com/tutorials/php/how-to-create-a-singleton-class-in-php/ **/ | |
| class User | |
| { | |
| // Hold an instance of the class | |
| private static $instance; | |
| // The singleton method |