License: GPL2 or later */ class APContent { function APContent() { add_action( 'admin_menu', array($this, 'admin_menu' )); add_filter( 'the_content', array($this, 'the_content' )); } function admin_menu() { add_submenu_page( 'options-general.php', 'Append Content', 'Append Content', 8, basename(__FILE__), array($this,'main' )); } function the_content( $content ) { $apc_ignore_pages = get_option ( 'apc_ignore_pages' ); if ( is_array( $apc_ignore_pages ) && in_array( get_the_ID(), $apc_ignore_pages ) ) return $content; if ( is_home() && get_option( 'apc_omit_home' ) == 1 ) return $content; if ( is_front_page() && get_option( 'apc_omit_front' ) == 1 ) return $content; if ( is_category() && get_option( 'apc_omit_cat' ) == 1 ) return $content; if ( is_tag() && get_option( 'apc_omit_tag' ) == 1 ) return $content; if ( is_date() && get_option( 'apc_omit_date' ) == 1 ) return $content; $publish = get_option( 'apc_publish' ); $apc_content = wpautop( get_option( 'apc_content' ) ); switch ( $publish ) { case 'all': $content .= "\n\n" . $apc_content; break; case 'posts': if ( !is_page(get_the_ID()) ) { $content .= "\n\n" . $apc_content; } break; case 'pages': if ( is_page(get_the_ID()) ) { $content .= "\n\n" . $apc_content; } break; default: break; } return $content; } function main() { ?>

Append Content Plugin Settings

Content Settings

Content settings updated.

'; } ?>


Publishing Settings

Publishing settings updated.

'; } } $apc_publish = get_option( 'apc_publish', 'all' ); ?>

Choose which posts/pages you'd like to apply content to:

0 ) { $apc_ignore_pages = array(); if ( isset( $_POST['apc_ignore_pages'] ) && is_array( $_POST['apc_ignore_pages'] ) ) $apc_ignore_pages = array_map( 'intval', $_POST['apc_ignore_pages'] ); update_option( 'apc_ignore_pages', $apc_ignore_pages ); } $apc_ignore_pages = get_option( 'apc_ignore_pages' ); $pages = wp_dropdown_pages(array( 'id' => 'apc-ignore-pages', 'name' => 'apc_ignore_pages[]', 'echo' => 0 )); $pages = str_replace( '
If you'd like to append content to ALL pages but ignore a small handful, select the pages in this list.