Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View uptimizt's full-sized avatar
💻
Code is poetry...

Antony I uptimizt

💻
Code is poetry...
View GitHub Profile
@uptimizt
uptimizt / wp-upload-image-from-url.php
Created April 17, 2022 08:44 — forked from RadGH/rs_upload_from_url.php
Upload an image to WordPress media gallery from URL
<?php
/**
* Retrieves an image from a URL and uploads it using ld_handle_upload_from_path. See that function for more details.
*
* Note: This function should also work for local file paths as well, but the implementation is slightly different than ld_handle_upload_from_path.
*
* @param $image_url
* @param int $attach_to_post
* @param bool|true $add_to_media
@uptimizt
uptimizt / get_post_by_meta.php
Created April 17, 2022 07:36 — forked from qstudio/get_post_by_meta.php
WordPress / Get Post by Meta Value
<?php
/**
* Get Post object by post_meta query
*
* @use $post = get_post_by_meta( array( meta_key = 'page_name', 'meta_value = 'contact' ) )
* @since 1.0.4
* @return Object WP post object
*/
function get_post_by_meta( $args = array() )
@uptimizt
uptimizt / .gitlab-ci.yml
Created December 16, 2020 07:25 — forked from khoipro/.gitlab-ci.yml
Deploy from GitLab to WPEngine (Tested)
stages:
- deploy_dev
- deploy_staging
- deploy_live
before_script:
- 'which ssh-agent || ( apk add --update openssh )'
- apk add --update bash
- apk add --update git
- eval $(ssh-agent -s)
@uptimizt
uptimizt / gh-pages-deploy.md
Created March 16, 2020 13:29 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@uptimizt
uptimizt / WP-CLI-Commands
Created October 26, 2018 07:34 — forked from mizner/WP-CLI-Commands
WP-CLI - Handy Commands
Search and replace
https://wp-cli.org/commands/search-replace/
wp search-replace
wp search-replace 'http://example.dev' 'http://example.com'
Optmize database
https://wp-cli.org/commands/db/optimize/
wp db optimize
Repair database
@uptimizt
uptimizt / example-nginx.conf
Last active August 8, 2018 16:45 — forked from gregrickaby/example-nginx.conf
Defer the loading of images to the production/live server if file not exist - NGINX
server {
# base nginx conf
location ~ ^/wp-content/uploads/(.*) {
try_files $uri @live_uploads;
}
location @live_uploads {
@uptimizt
uptimizt / correct-cookie-domain.php
Created July 8, 2018 13:34 — forked from danielbachhuber/correct-cookie-domain.php
Correct the cookie domain when a custom domain is mapped to the site.
@uptimizt
uptimizt / install-ioncube.sh
Created May 11, 2018 10:44 — forked from litzinger/install-ioncube.sh
Install IonCube in PuPHPet
echo "Loading ioncube"
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
echo "Unzipping ioncube"
tar xvfz ioncube_loaders_lin_x86-64.tar.gz
echo "Move ioncube to usr/local"
mv ioncube /usr/local
echo "Add ioncube to php.ini"
sudo sed -i 1i"zend_extension=/usr/local/ioncube/ioncube_loader_lin_5.4.so" /etc/php5/fpm/conf.d/zzzz_custom.ini
sudo sed -i 1i"zend_extension=/usr/local/ioncube/ioncube_loader_lin_5.4.so" /etc/php5/cli/conf.d/zzzz_custom.ini
echo "Restarting Apache and FPM"