Install software-properties-common
sudo apt-get install software-properties-common
Add Repo
sudo add-apt-repository ppa:olipo186/git-auto-deploy
<?php | |
/** | |
* Duplicates a post & its meta and it returns the new duplicated Post ID | |
* @param [int] $post_id The Post you want to clone | |
* @return [int] The duplicated Post ID | |
*/ | |
function duplicate($post_id) { | |
$title = get_the_title($post_id); | |
$oldpost = get_post($post_id); |
# ---------------------------------------------------------------------- | |
# Password protect staging server | |
# Use one .htaccess file across multiple environments | |
# (e.g. local, dev, staging, production) | |
# but only password protect a specific environment. | |
# ---------------------------------------------------------------------- | |
SetEnvIf Host staging.domain.com passreq | |
AuthType Basic | |
AuthName "Password Required" |
/** | |
* Returns an array of field groups with fields for the passed CPT, where field group ACF location rule of "post_type == CPT" exists. | |
* - each field group points at an array of its fields, in turn pointed at an array of that field's detailed information: | |
* - array of info for each field [ ID, key, label, name, type, menu_order, instructions, required, id, class, conditional_logic[array()], etc. ] | |
* | |
* @since 1.0.0 | |
*/ | |
function get_acf_field_groups_by_cpt($cpt) { | |
// need to create cache or transient for this data? | |
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) { | |
echo 'This is the last post'; | |
} ?> | |
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) { | |
echo 'This is the not the last post'; | |
} ?> |
add_filter( 'terms_clauses', 'filter_terms_clauses', 10, 3 ); | |
/** | |
* Filter WP_Term_Query meta query | |
* | |
* @param object $query WP_Term_Query | |
* @return object | |
*/ | |
function filter_terms_clauses( $pieces, $taxonomies, $args ) { | |
global $pagenow, $wpdb; |
Install software-properties-common
sudo apt-get install software-properties-common
Add Repo
sudo add-apt-repository ppa:olipo186/git-auto-deploy
<?php | |
/** | |
* Enqueue scripts and styles. | |
* | |
* @since 1.0.0 | |
*/ | |
function ja_global_enqueues() { | |
wp_enqueue_style( | |
'jquery-auto-complete', |
<?php | |
/* | |
Important! | |
Make sure to replace {my_} with your theme's unique prefix. | |
All future functions you write should use that same prefix. | |
Example: mrwnten_parent_theme_enqueue_styles() | |
*/ | |
add_action( 'wp_enqueue_scripts', '{my_}parent_theme_enqueue_styles' ); |
Create a new repository, or reuse an existing one.
Generate a new SSH key:
ssh-keygen -t rsa -C "[email protected]"
Copy the contents of the file ~/.ssh/id_rsa.pub
to your SSH keys in your GitHub account settings (https://github.com/settings/keys).
Test SSH key:
# This is a template .gitignore file for git-managed WordPress projects. | |
# | |
# Fact: you don't want WordPress core files, or your server-specific | |
# configuration files etc., in your project's repository. You just don't. | |
# | |
# Solution: stick this file up your repository root (which it assumes is | |
# also the WordPress root directory) and add exceptions for any plugins, | |
# themes, and other directories that should be under version control. | |
# | |
# See the comments below for more info on how to add exceptions for your |