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 | |
/** | |
* This file handles the cloning of any post type. | |
*/ | |
class Clone_Posts { | |
/** | |
* Instances of child classes. | |
* |
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 fix is related to this comment: | |
* | |
* https://github.com/alleyinteractive/wordpress-fieldmanager/issues/553#issuecomment-260527132 | |
*/ | |
jQuery( document ).ready( function( $ ) { | |
$( document ).on( 'fm_sortable_drop', function( e, ui ) { | |
custom_fm_renumber( $( ui ) ); | |
} ); |
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 | |
/** | |
* Perform a custom redirect for old slugs based on multiple post types. WordPress | |
* by default will only redirect old slugs for a single post type but since | |
* the post_type param is an array we had to implement this custom logic. | |
* This function will use WP_Query instead of MySQL code like the original does. | |
* | |
* @link https://github.com/WordPress/WordPress/blob/139387b7e554e7a22975470cca5d2ed6ce4c8eb4/wp-includes/query.php#L4950-L4954 | |
* | |
* @global WP_Query $wp_query Global WP_Query instance. |
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 | |
class Create_Attachment extends WP_UnitTestCase { | |
public function setUp() { | |
parent::setUp(); | |
// List of images here: https://core.trac.wordpress.org/browser/trunk/tests/phpunit/data/images | |
$this->attachment_id = $this->factory->attachment->create_upload_object( DIR_TESTDATA . '/images/test-image.png', 0 ); | |
} | |
} |
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 | |
/** | |
* An exmaple of how a custom permastruct can be setup with a CPT. | |
* Notice how we use %gallery% and not %postname%, this is becuase | |
* WordPress using different tags for CPTs. | |
* | |
* 1) /[primary-category]/[gallery-headline] | |
* 2) /[primary-category]/[gallery-headline]/[slide-headline] | |
*/ |
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
[a-z]([A-Z])+[(] |
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 | |
// First, make sure Jetpack doesn't concatenate all its CSS | |
add_filter( 'jetpack_implode_frontend_css', '__return_false' ); | |
// Then, remove each CSS file, one at a time | |
function dequeue_all_jetpack_stylesheets() { | |
wp_deregister_style( 'AtD_style' ); // After the Deadline | |
wp_deregister_style( 'jetpack_likes' ); // Likes | |
wp_deregister_style( 'jetpack_related-posts' ); //Related Posts | |
wp_deregister_style( 'jetpack-carousel' ); // Carousel |
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
jQuery(document).ready(function($){ | |
// Call the /posts endpoint via the WordPress API | |
$.get("http://wpuat.com/massive/wp-json/wp/v2/posts", function (posts) { | |
// Loop through all the posts returned and console.log() each of | |
// their HTML content | |
$.each(posts, function(index, post) { | |
console.log(post.content['rendered']); | |
}); |
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 | |
// This is wrapped within a class to prevent conflicts, and it is called | |
// client-side via the WordPres AJAX API | |
function get_posts() { | |
$page = 1; | |
$total_posts = array(); | |
$posts = get_posts( array( | |
'posts_per_page' => 100, |