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
<?php | |
function getAllCRMIds() { | |
global $wpdb; | |
$blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs} WHERE blog_id != {$wpdb->blogid} AND site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' order by blog_id", ARRAY_A); | |
// array_unshift($blogs, 1); /*Including parent blog in the array*/ | |
$crm_to_blog = array(); | |
foreach($blogs as $blog) { | |
switch_to_blog( $blog[ 'blog_id' ] ); |
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
<?php | |
/** | |
* Function that will automatically update ACF field groups via JSON file update. | |
* | |
* @link http://www.advancedcustomfields.com/resources/synchronized-json/ | |
*/ | |
function jp_sync_acf_fields() { | |
// vars | |
$groups = acf_get_field_groups(); | |
$sync = array(); |
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
REMOTE_REPOSITORY=${REMOTE_REPOSITORY:?'You need to configure the REMOTE_REPOSITORY environment variable!'} | |
REMOTE_BRANCH=${REMOTE_BRANCH:?'You need to configure the REMOTE_BRANCH environment variable!'} | |
set -e | |
git fetch --unshallow || true | |
git push ${REMOTE_REPOSITORY} ${CI_COMMIT_ID}:${REMOTE_BRANCH} | |
cd wp-content/themes/<theme> | |
npm install -g bower gulp | |
npm install | |
bower install | |
gulp --production |
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
function custom_post_type_in_home_loop( $query ) { | |
if ( is_home() && $query->is_main_query() ) | |
$query->set( 'post_type', array( 'post', 'travel','deals','food_cooking') ); | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'custom_post_type_in_home_loop' ); |
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
function change_post_label() { | |
global $menu; | |
global $submenu; | |
$menu[5][0] = 'News'; | |
$submenu['edit.php'][5][0] = 'News'; | |
$submenu['edit.php'][10][0] = 'Add News'; | |
$submenu['edit.php'][16][0] = 'News Tags'; | |
echo ''; | |
} | |
function change_post_object() { |
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
// HIGHLIGHT SEARCH RESULTS | |
function wps_highlight_results($text){ | |
if(is_search()){ | |
$sr = get_query_var('s'); | |
$keys = explode(" ",$sr); | |
$text = preg_replace('/('.implode('|', $keys) .')/iu', '<span class="label label-default">'.$sr.'</span>', $text); | |
} | |
return $text; | |
} | |
add_filter('the_excerpt', 'wps_highlight_results'); |
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
<header> | |
<h1 class="entry-title">One morning, when Gregor Samsa woke from troubled dreams.</h1> | |
<time class="updated" datetime="2012-08-02T17:14:25+00:00">August 2, 2012</time> | |
<p class="byline author vcard"> | |
By | |
<a href="#author-page" rel="author" class="fn">admin</a> | |
</p> | |
</header> | |
<div class="entry-content"> |
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
<?php | |
/** | |
* Hide Standard Shipping option when free shipping is available | |
* | |
* @param array $available_methods | |
*/ | |
function hide_standard_shipping_when_free_is_available( $available_methods ) { | |
if( isset( $available_methods['free_shipping'] ) AND isset( $available_methods['flat_rate'] ) ) { |
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
<?php | |
/** | |
* Hides the 'view' button in the post edit page | |
* | |
*/ | |
function hv_hide_view_button() { | |
$current_screen = get_current_screen(); |