Skip to content

Instantly share code, notes, and snippets.

@jchristopher
jchristopher / functions.php
Created August 5, 2022 14:49
Tell OrganizeWP about our custom Smart Group
<?php
// Tell OrganizeWP about our custom Smart Group.
// @link https://organizewp.com/docs/smart-groups/
// @link https://gist.github.com/jchristopher/8488c91eb6c0d90922ec686865e23a2f
add_filter( 'organizewp/smart_groups', function( $smart_groups ) {
$smart_groups['my_owp_posts_no_comments'] = new MyOwpPostsNoComments();
return $smart_groups;
} );
@jchristopher
jchristopher / functions.php
Last active August 5, 2022 14:48
Custom OrganizeWP Smart Group to lists Posts with no Comments
<?php
// Custom OrganizeWP Smart Group to lists Posts with no Comments.
// @link https://organizewp.com/docs/smart-groups/
class MyOwpPostsNoComments extends \OrganizeWP\SmartGroup {
function __construct() {
$this->name = 'no_comments';
$this->label = 'No Comments';
}
@jchristopher
jchristopher / functions.php
Created August 5, 2022 13:27
Tell OrganizeWP to use our Comments Info Column
<?php
// Tell OrganizeWP to use our Comments Info Column
// @link https://gist.github.com/jchristopher/6892032eeec8d0ad3087ea166eb97b45
// @link https://organizewp.com/docs/info-columns/
add_filter( 'organizewp/post_type/info_columns', function( $info_columns, \OrganizeWP\PostType $post_type ) {
$info_columns['my_owp_comments'] = new MyOwpInfoColumnComments( $post_type );
return $info_columns;
}, 10, 2 );
<?php
// Custom OrganizeWP Info Column to display Comment count for each entry.
// @link https://organizewp.com/docs/info-columns/
class MyOwpInfoColumnComments extends \OrganizeWP\PostTypeInfoColumn {
function __construct( \OrganizeWP\PostType $post_type ) {
$this->assets();
}
@jchristopher
jchristopher / functions.php
Created August 5, 2022 13:03
Enable Modified Info Column in OrganizeWP
<?php
// Enable Modified Info Column in OrganizeWP.
// @link https://organizewp.com/docs/info-columns/
add_filter( 'organizewp/post_type/info_columns/modified', '__return_true' );
@jchristopher
jchristopher / functions.php
Created August 5, 2022 13:01
Enable Author Info Column in OrganizeWP
<?php
// Enable Author Info Column in OrganizeWP.
// @link https://organizewp.com/docs/info-columns/
add_filter( 'organizewp/post_type/info_columns/author', '__return_true' );
@jchristopher
jchristopher / functions.php
Created August 4, 2022 17:04
Insert our OrganizeWP comment count Entry Panel Pane
<?php
// Insert our OrganizeWP comment count Entry Panel Pane.
// @link https://organizewp.com/docs/entry-panel/
// @link https://gist.github.com/jchristopher/922d0a9396f72a44090c2af64561d71f
// @link https://gist.github.com/jchristopher/94d0c4c565ef32d5a419ba857bd27b5f
add_filter( 'organizewp/entry_panel/panes', function( $panes, $panel ) {
$panes['my_owp_comment_count'] = new MyOwpPaneEntryComments( $panel );
return $panes;
@jchristopher
jchristopher / functions.php
Created August 4, 2022 17:02
Define the OrganizeWP Entry Panel Pane for our comment count Pane Item
<?php
// Define the OrganizeWP Entry Panel Pane for our comment count Pane Item.
// @link https://organizewp.com/docs/entry-panel/
// @link https://gist.github.com/jchristopher/922d0a9396f72a44090c2af64561d71f
class MyOwpPaneEntryComments extends \OrganizeWP\EntryPanelPane {
function init() {
$this->name = 'comments';
$this->label = 'Comments';
$this->show_label = false;
@jchristopher
jchristopher / functions.php
Last active August 4, 2022 17:04
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';
}
@jchristopher
jchristopher / functions.php
Created August 4, 2022 16:35
Disable 'Quick Info' Entry Panel Pane in OrganizeWP
<?php
// Disable 'Quick Info' Entry Panel Pane in OrganizeWP
// @link https://organizewp.com/docs/entry-panel/
add_filter( 'organizewp/entry_panel/panes/quick_info', '__return_false' );