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
// PLEASE NOTE! | |
// I set my ACF Image Repeater to return only the image ID... | |
// So this may not work if you have it set to return an Object or...? | |
// I found this helpful: https://support.advancedcustomfields.com/forums/topic/repeater-update_field/ | |
add_action( 'init', 'cmb2_to_acf' ); | |
function cmb2_to_acf() { | |
// You can use offset if needed. | |
$args = 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
// make sure to comment out add_action when you're done, or working on the data | |
add_action( 'init', 'cmb2_to_acf' ); | |
function cmb2_to_acf() { | |
// You can use offset if needed. | |
$args = array( | |
'post_type' => 'some_post_type', | |
'numberposts' => 400, // whatever number. | |
// 'offset' => 800, | |
); |
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
add_action( 'init', 'test_update_products' ); | |
function test_update_products() { | |
// You can use offset if needed. | |
$args = array( | |
'post_type' => 'my_awesome_cpt', | |
'numberposts' => 300, | |
//'offset' => 1000, | |
); |
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 | |
// ALL OF THIS IS FROM: https://www.linkedin.com/pulse/wp-speed-up-from-ground-alex-knopp | |
// Post Revisions | |
// WordPress will simply store every single post revision you create. If your a developer like me then my clients websites change a lot and these post revisions build up. Add the following to your wp-config.php file to stipulate the number of post revisions saved at any one time. | |
//Define the number of post revisions to be saved | |
define( 'WP_POST_REVISIONS', 3 ); | |
// WordPress Bloat |
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
// this filter adds the custom field values to the json output for The Events Calendar | |
// https://theeventscalendar.com/support/forums/topic/custom-field-output-for-json-feed/ | |
add_filter( 'tribe_rest_event_data', 'omfg_add_event_customfields' ); | |
function omfg_add_event_customfields($data) { | |
$event_id = $data['id']; | |
$some_data = 'some data'; | |
$data = array_merge( $data, | |
// This is for a single value |
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($) { | |
let pages = [ | |
'Home', | |
'About', | |
'Contact' | |
// whatever.... | |
]; | |
function addPages(pageArray){ | |
// Create a page with the WordPress REST API |
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
$spacing-values: ( | |
1, | |
2, | |
3, | |
4, | |
5, | |
); | |
@each $val in $spacing-values { | |
// REMS |
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 | |
/** | |
* Loads media from a remote site when on a local dev environment. | |
* Eliminates the need to download the uploads directory from the remote site for testing purposes. | |
* Just make sure to update the obvious URLs below 🤔👏🎉 | |
* Also, throw this in your mu-plugins folder, or create a plugin for yourself. | |
*/ | |
if ( 'yourbigfatwebsite.local' === $_SERVER['HTTP_HOST'] ): | |
add_filter( 'upload_dir', function ( $uploads ) { | |
$uploads['baseurl'] = 'http://yourbigfatwebsite.com/wp-content/uploads'; |
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
// HTML is whatever you like | |
function awc_post_thumbnail_add_description( $content, $post_id ){ | |
$post = get_post( $post_id ); | |
$post_type = $post->post_type; | |
if ( $post_type = 'post') { | |
$content .= "<div style='background-color: #eee;padding: 1rem;'> | |
<h3><label for=\"html\"><strong>Best size: <br>900px wide by 600px tall</strong></label></h3> | |
</div>"; | |
return $content; | |
return $post_id; |