Skip to content

Instantly share code, notes, and snippets.

@jchristopher
Last active August 4, 2022 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jchristopher/922d0a9396f72a44090c2af64561d71f to your computer and use it in GitHub Desktop.
Save jchristopher/922d0a9396f72a44090c2af64561d71f to your computer and use it in GitHub Desktop.
Define an OrganizeWP Entry Pane Item to output the comment count for the current entry.
<?php
// Define an OrganizeWP Entry Pane Item to output the comment count for the current entry.
// @link https://organizewp.com/docs/entry-panel/
class MyOwpPaneEntryCommentsCount extends \OrganizeWP\EntryPanelPaneItem {
function init() {
$this->name = 'entry_comments';
$this->label = 'Comments';
}
// Output HTML to the OrganizeWP Entry Pane.
function render() {
return 'Comments: <strong>' . get_comment_count( $this->entry->ID )['approved'] . '</strong>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment