Skip to content

Instantly share code, notes, and snippets.

@gegere
Created January 23, 2015 23:32
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 gegere/c7791816960cd9b2441a to your computer and use it in GitHub Desktop.
Save gegere/c7791816960cd9b2441a to your computer and use it in GitHub Desktop.
HTMLgraphic Components
<?php
/*
Plugin Name: HTMLgraphic Components
Plugin URI: http://www.htmlgraphic.com
Version: 0.2
Date: 2010-10-11
Author: Jason Gegere
Author URI: http://www.htmlgraphic.com
Author Email: jason@htmlgraphic.com
Description: This plugin removes many of the bashboard widgets that are not needed on the admin side. A HTMLgraphic News feed has been added to answer many common WordPress questions.
*/
/*
Copyright (C) 2010 HTMLgraphic Designs, LLC, htmlgraphic.com (designs@htmlgraphic.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Hide the version information of WordPress
remove_action( 'wp_head','wp_generator' );
// More information: http://www.htmlgraphic.com/wordpress/wlwmanfest-disable/
remove_action( 'wp_head','wlwmanifest_link' );
// Remove Comments Feed
function remove_comments_rss( $for_comments ) { return; }
add_filter('post_comments_feed_link','remove_comments_rss');
/**
* Display the XHTML author that is generated on the wp_head hook.
*
*/
function hg_meta_update() {
echo '<meta name="author" content="Created by HTMLgraphic Designs" />';
}
add_action('wp_head','hg_meta_update');
/**
*
* Customize the admin side to remove widgets that are not needed.
*
*/
function my_custom_dashboard_widgets() {
// Globalize the metaboxes array, this holds all the widgets for wp-admin
global $wp_meta_boxes;
// Remove the incomming links widget
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
// Remove right now
//unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
//unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
unset($wp_meta_boxes['dashboard']['normal']['core']['yoast_db_widget']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
wp_add_dashboard_widget('custom_help_widget', 'Help and Support', 'custom_dashboard_help');
}
// Hook into the 'wp_dashboard_setup' action to register our function
add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets' );
function custom_dashboard_help() {
echo '<p>Welcome to your custom theme! Need help? Contact the developer <a href="http://www.htmlgraphic.com/contact/">here</a>.<a href="%E2%80%9Dhttp://www.htmlgraphic.com/contact/%E2%80%9D"></a></p>';
}
/**
*
* Custom Feed (HTMLgraphic Client News) Widget
*
*/
function my_add_dashboard_widget() {
wp_add_dashboard_widget( 'dashboard_custom_feed', 'HTMLgraphic - WordPress Tips', 'my_dashboard_custom_feed_output' );
}
function my_dashboard_custom_feed_output() {
echo '<div class="rss-widget">';
wp_widget_rss_output( array(
'url' => 'http://www.htmlgraphic.com/tag/client-news/feed/',
'title' => 'HTMLgraphic - WordPress Tips',
'link' => 'http://www.htmlgraphic.com/tag/client-news/',
'items' => 5,
'show_summary' => 1,
'show_author' => 0,
'show_date' => 1
));
echo "</div>";
}
add_action( 'wp_dashboard_setup', 'my_add_dashboard_widget' );
/**
*
* Remove the HTML attributes below the comments form
*
*/
function mytheme_init() {
add_filter('comment_form_defaults','mytheme_comments_form_defaults');
}
add_action('after_setup_theme','mytheme_init');
function mytheme_comments_form_defaults($default) {
unset($default['comment_notes_after']);
return $default;
}
/**
*
* WP Admin side plugin options specific to the needs of HTMLgraphic Designs
*
*/
function HG_init() {
add_action('admin_menu', 'HG_config_page');
add_filter('plugin_action_links', 'HG_actions', 10, 2 );
//add_action('wp_footer', 'peb_footer');
}
add_action('init', 'HG_init');
function HG_config_page() {
if ( function_exists('add_options_page') )
add_options_page('HG Options', 'HTMLgraphic', 8, 'HG', 'HG_conf');
}
function HG_actions($links, $file){
$this_plugin = plugin_basename(__FILE__);
if ( $file == $this_plugin ){
$settings_link = '<a href="options-general.php?page=HG">' . __('Use') . '</a>';
array_unshift($links, $settings_link);
}
return $links;
}
function HG_conf() {
?>
<div class="wrap">
<h2>HTMLgraphic</h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>
<p>More options coming soon...</p>
</form>
</div>
<?php
}
/** Override default file permissions for installing plugins */
if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
} else {
// This will disallow WordPress core updates from /wp-admin
define( 'DISALLOW_FILE_MODS', true );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment