This file contains hidden or 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
| <?php | |
| /* | |
| Plugin Name: Draft Feed | |
| Plugin URI: | |
| Description: Add a new Feed for drafts: <code>/?feed=drafts</code> | |
| Version: 0.1 | |
| Author: Frank Bültge | |
| Author URI: http://bueltge.de/ | |
| */ |
This file contains hidden or 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
| <?php | |
| // Simple way | |
| add_filter( 'show_admin_bar', '__return_false' ); | |
| // Standard way | |
| add_filter( 'show_admin_bar', 'show_admin_bar_cb' ); | |
| function show_admin_bar_cb() { | |
| return false; | |
| } | |
| // Hide admin bar for all users except admin | |
| add_filter( 'show_admin_bar', 'show_admin_bar_cb' ); |
This file contains hidden or 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
| /** | |
| * Remove "Trash" option from non-admin users | |
| * Added: 08/03/15 rveitch | |
| */ | |
| if ( ! is_admin() ) { | |
| add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 ); | |
| function remove_row_actions( $actions ) | |
| { | |
| if( get_post_type() === 'post' ) | |
| unset( $actions['trash'] ); |
This file contains hidden or 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
| public function set_plugin_meta( $links, $file ) { | |
| static $plugin; | |
| $plugin = plugin_basename( __FILE__ ); | |
| if ( $file == $plugin ) { | |
| $links[] = '<a href="https://gist.github.com/rveitch/170878f415d43327116c">GitHub</a>'; | |
| } | |
| return $links; | |
| } |
This file contains hidden or 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
| <?php | |
| ! defined( 'ABSPATH' ) and exit; | |
| add_filter( 'plugins_loaded', array( 'Autoload_Includes', 'get_object' ) ); | |
| // begin class | |
| class Autoload_Includes { | |
| /* Define folder, there have inside the autoload files */ |
This file contains hidden or 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
| <?php | |
| /** | |
| * Load an included file | |
| */ | |
| function load_this_file() { | |
| require_once( plugin_dir_path( __FILE__ ) . 'includes/this-file.php' ); | |
| } | |
| add_action( 'init', 'load_this_file' ); |
This file contains hidden or 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
| <?php | |
| /** | |
| * Load CSS for admin/plugin dashboard | |
| */ | |
| function load_admin_css_styles() { | |
| wp_enqueue_style( 'yourstyle-css', plugins_url( 'css/yourstyle.css', __FILE__ ) ); | |
| } | |
| add_action( 'admin_enqueue_scripts', 'load_admin_css_styles' ) |
This file contains hidden or 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
| <?php | |
| /** | |
| * Insert a new Post Category | |
| */ | |
| function example_insert_category() { | |
| wp_insert_term( | |
| 'Example Category', | |
| 'category', | |
| array( | |
| 'description' => 'This is an example category created with wp_insert_term.', |
This file contains hidden or 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
| <?php | |
| /** | |
| * Insert default AreaVoices post categories | |
| */ | |
| function insert_av_post_categories() { | |
| /* Rename the default 'Uncategorized' category */ | |
| //wp_update_term(1, 'category', array( 'name' => 'Arts & Entertainment', 'slug' => 'arts-entertainment' )); | |
This file contains hidden or 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
| <?php | |
| /** | |
| * JSON Feed Template for displaying JSON Posts feed. | |
| * | |
| */ | |
| $callback = trim(esc_html(get_query_var('callback'))); | |
| $charset = get_option('charset'); | |
| query_posts( array( 'post_type' => 'live_video' ) ); |