Skip to content

Instantly share code, notes, and snippets.

View seafarer's full-sized avatar
☎️
DM me, maybe

Colin OBrien seafarer

☎️
DM me, maybe
View GitHub Profile
@seafarer
seafarer / wp-post-images
Created July 24, 2013 03:22
Access wordpress post images uploaded and inserted through gallery function
<?php
$args = array(
'numberposts' => -1, // Using -1 loads all posts
'orderby' => 'menu_order', // This ensures images are in the order set in the page media manager
'order'=> 'ASC',
'post_mime_type' => 'image', // Make sure it doesn't pull other resources, like videos
'post_parent' => $post->ID, // Important part - ensures the associated images are loaded
'post_status' => null,
'post_type' => 'attachment'
@seafarer
seafarer / remove-widgets-from-wp-dashboard
Created July 24, 2013 02:54
Remove widgets from wordpress dashboard
function 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_right_now']);
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']);
@seafarer
seafarer / Change wp menu label
Created July 24, 2013 02:46
Change 'posts' to 'blog' in wordpress admin
function change_post_menu_label() {
global $menu;
global $submenu;
$menu[5][0] = 'Blog';
$submenu['edit.php'][5][0] = 'Blog Posts';
$submenu['edit.php'][10][0] = 'Add Blog Post';
echo '';
}
add_action( 'admin_menu', 'change_post_menu_label' );
@seafarer
seafarer / Reorder wordpress admin menu
Last active December 20, 2015 03:59
Reorder wordpress admin menu
function custom_menu_order($menu_ord) {
if (!$menu_ord) return true;
return array(
'index.php', // Dashboard
'separator1', // First separator
'edit.php?post_type=page', // Pages
'edit.php?post_type=project', // Custom post type project
'edit.php?post_type=accolade', // Custom post type accolade
'edit.php', // Posts