This file contains 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
function make_rows($array, $per = 4) | |
{ | |
$rows = array(); | |
$c = 1; | |
$row = 0; | |
foreach($array as $item) | |
{ | |
$rows[ $row ][] = $item; | |
if($c == $per) { $row++; $c = 0; } | |
$c++; |
This file contains 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
// ADD CUSTOM BODY CLASSES | |
add_filter('body_class','hg_body_classes'); | |
function hg_body_classes($classes) | |
{ | |
$classes[] = "theme-" . get_stylesheet(); | |
// ... other theme logic | |
return $classes; | |
} |
This file contains 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 DASHBOARD WIDGETS | |
function hg_remove_dashboard_widgets() | |
{ | |
global $wp_meta_boxes; | |
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); | |
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); | |
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); | |
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_drafts']); | |
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); | |
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); |
This file contains 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
// ADMIN BAR UPDATES | |
function hg_remove_admin_bar_links() | |
{ | |
global $wp_admin_bar; | |
$wp_admin_bar->remove_menu('wp-logo'); // Remove the WordPress logo | |
$wp_admin_bar->remove_menu('about'); // Remove the about WordPress link | |
$wp_admin_bar->remove_menu('wporg'); // Remove the WordPress.org link | |
$wp_admin_bar->remove_menu('documentation'); // Remove the WordPress documentation link | |
$wp_admin_bar->remove_menu('support-forums'); // Remove the support forums link | |
$wp_admin_bar->remove_menu('feedback'); // Remove the feedback link |
This file contains 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
// DIRECT LINK TO HOMEPAGE FROM ADMIN MENU | |
if(get_option( 'page_on_front' )) | |
{ | |
add_action('admin_menu', 'hg_homepage_link'); | |
function hg_homepage_link() | |
{ | |
add_submenu_page( 'edit.php?post_type=page', 'Homepage', 'Homepage', 'manage_options', 'post.php?post=' . get_option( 'page_on_front' ) . '&action=edit' ); | |
} | |
} |
This file contains 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
// GET FEATURED IMAGE | |
function hg_get_featured_image( $id, $size = 'post-thumbnail', $allow_empty = false ) | |
{ | |
$rtn = false; | |
// TRY FEATURED IMAGE | |
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $id ), $size ); | |
// IF NOT GET FIRST IMAGE ATTACHMENT FROM POST |
This file contains 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
// PAGE EXCERPT | |
add_action('init', 'hg_pe_init'); | |
function hg_pe_init() { if(function_exists("add_post_type_support")) { add_post_type_support( 'page', 'excerpt' ); } } | |
OlderNewer