New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post abstraction #964
Post abstraction #964
Conversation
This is how I've been testing, it var_dumps the object in place of the posts content on the front end of the site: function xu_dist_nope_the_content( $content ) {
if (
is_admin()
|| ( defined( 'REST_REQUEST' ) && REST_REQUEST )
) {
return $content;
}
if ( is_singular() && in_the_loop() && is_main_query() ) {
remove_filter( 'the_content', 'xu_dist_nope_the_content' );
$post = get_post();
$dt = new Distributor\DistributorPost( $post );
$t = $dt->original_post_url;
// $t = $dt_clone->source_site;
// This is just to get a smaller dump.
$dt_clone = clone $dt;
unset( $dt_clone->post->post_content );
ob_start();
var_dump( get_post()->ID, $dt_clone );
var_dump( isset( $dt_clone->original_post_url ) );
return ob_get_clean();
}
return $content;
}
add_filter( 'the_content', 'xu_dist_nope_the_content' ); |
I think this is in a good spot for an initial review and (hopefully) merge so I can proceed to use it in the connectors in follow up PRs. I'm sure it will change/expand slightly during implimentation but I think getting it in earlier is probably better than a mega PR. Prepare media is pretty substantial in that it now parses all media rather than just those attached to the post directly. |
4456ab8
to
ef4bce7
Compare
@dkotter Sorry, I managed to dismiss your review wrapping up the tests.
Are you happy for this to go in |
Yeah, that sounds good to me |
Description of the Change
Creates a post abstraction to aid with the distribution of posts without the need to duplicate code across each connection type.
Closes #207
How to test the Change
WIP
Changelog Entry
Credits
Props @peterwilsoncc, @dkotter
Checklist: