Skip to content

Instantly share code, notes, and snippets.

@rveitch
Last active February 1, 2025 00:42
Show Gist options
  • Select an option

  • Save rveitch/1eb0214ab5c0a67fe4eaa5424722219c to your computer and use it in GitHub Desktop.

Select an option

Save rveitch/1eb0214ab5c0a67fe4eaa5424722219c to your computer and use it in GitHub Desktop.
CoSchedule WordPress Plugin - Get Full Post Example (Debug Bar Console)
<?php
// Debug the CoSchedule Plugin
$post_id = 522; // Replace this ID with an ID of a post you want to check.
if (class_exists( 'TM_CoSchedule' )) {
$coschedule = new TM_CoSchedule;
$full_post = $coschedule->get_full_post( $post_id );
echo '$full_post:<br><pre>'; print_r(json_encode($full_post, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT)); echo '</pre><br><br>';
} else {
echo 'Class does not exist.';
}
// Debug the Upload Directory
$upload_dir = wp_upload_dir();
echo '$upload_dir:<br><pre>'; print_r(json_encode($upload_dir, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT)); echo '</pre>';
?>
@rveitch

rveitch commented Feb 28, 2018

Copy link
Copy Markdown
Author

Uses the Debug Bar and Debug Bar Console plugins.

The TM_CoSchedule class calls the get_full_post() function, which calls get_thumbnail() and get_attachements();

TM_CoSchedule::
    get_full_post( $post_id )
      get_thumbnail( $post_id )
      get_attachments( $post['post_content'] )

image

Custom Build V2 Changes
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment