-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e976afc
commit 99cc3d9
Showing
5 changed files
with
68 additions
and
34 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
function testrev() { | ||
|
||
global $wpdb; | ||
|
||
$post_id = get_the_ID(); | ||
$revisions = $wpdb->get_results("select * from {$wpdb->posts} where post_parent={$post_id} and post_type='revision'"); | ||
|
||
ob_start(); | ||
echo '<pre>'; | ||
print_r($revisions); | ||
echo '</pre>'; | ||
return ob_get_clean(); | ||
|
||
|
||
ob_start(); | ||
wp_list_post_revisions( get_the_ID(), 'revision' ); | ||
$revisions = ob_get_clean(); | ||
|
||
return $revisions; | ||
|
||
$output = ''; | ||
|
||
if ( ! $revisions = wp_get_post_revisions( get_the_ID() ) ) { | ||
return $output; | ||
} | ||
|
||
$rows = ''; | ||
foreach ( $revisions as $revision ) { | ||
if ( ! current_user_can( 'read_post', $revision->ID ) ) { | ||
continue; | ||
} | ||
$rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n"; | ||
} | ||
|
||
$output .= "<ul class='post-revisions hide-if-no-js'>\n"; | ||
$output .= $rows; | ||
$output .= '</ul>'; | ||
|
||
// At the end of your shortcode function, make sure to.. | ||
return $output; | ||
} | ||
add_shortcode( 'wppedia_revisions', 'testrev' ); |
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 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 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