Skip to content

Instantly share code, notes, and snippets.

@sambody
sambody / All hybrid hooks
Created June 15, 2013 10:45
Hybrid: core hooks (contexts for inserting stuff). Source: plugin Hybrid Hook to add things via admin
hybrid_before_html
hybrid_after_html
hybrid_before_header
hybrid_header
hybrid_after_header
hybrid_before_primary_menu
hybrid_after_primary_menu
@sambody
sambody / Set max width for video etc
Created June 14, 2013 12:41
WP: Set max width for embedded media (video etc)
/* Set max width for embedded media (video etc)
*/
if ( ! isset( $content_width ) ) $content_width = 600;
@sambody
sambody / Remove admin metaboxes
Created June 14, 2013 11:07
WP: Remove metaboxes from posts and pages editor.
<?php
/* Remove metaboxes for POSTS - uncomment to activate
*/
function remove_my_post_metaboxes() {
// under the editor
//remove_meta_box( 'authordiv','post','normal' ); // Author Metabox
//remove_meta_box( 'commentstatusdiv','post','normal' ); // Comments Status Metabox
//remove_meta_box( 'commentsdiv','post','normal' ); // Comments Metabox
remove_meta_box( 'postcustom','post','normal' ); // Custom Fields Metabox
//remove_meta_box( 'postexcerpt','post','normal' ); // Excerpt Metabox
@sambody
sambody / Login page customization
Created June 14, 2013 11:04
WP: login page customization
/* ================ LOGIN PAGE CUSTOMIZATION
*/
// 1. Add stylesheet
function sam_custom_login_styles(){
?><link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/forms.css" type="text/css" />
<link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/css/login.css" type="text/css" />
<?php
}
add_action('login_head', 'sam_custom_login_styles');
@sambody
sambody / extra body classes
Created June 14, 2013 11:02
WP: Add extra body classes - taken from plugin Ambrosite Body Class Enhanced
/* Add extra body classes (on top of WP body classes) - taken from plugin Ambrosite Body Class Enhanced
*/
function sam_body_class($classes) {
// If you don't like the class prefixes I have chosen, you can change them here.
$post_name_prefix = 'postname-';
$page_name_prefix = 'pagename-';
$single_term_prefix = 'single-';
$single_parent_prefix = 'parent-';
$category_parent_prefix = 'parent-category-';
$term_parent_prefix = 'parent-term-';