Skip to content

Instantly share code, notes, and snippets.

View JiveDig's full-sized avatar

Mike Hemberger JiveDig

View GitHub Profile
/* actions fired when listing/adding/editing posts or pages */
/* admin_head-(hookname) */
add_action( 'admin_head-post.php', 'admin_head_post_editing' );
add_action( 'admin_head-post-new.php', 'admin_head_post_new' );
add_action( 'admin_head-edit.php', 'admin_head_post_listing' );
function admin_head_post_editing() {
echo 'you are editing a post';
}
@JiveDig
JiveDig / comment_avatar_size.php
Last active August 29, 2015 14:10 — forked from GaryJones/functions.php
Change size of comment avatars in Genesis
<?php
/**
* Change size of comment avatars.
*/
add_filter( 'genesis_comment_list_args', 'childtheme_comment_list_args' );
function childtheme_comment_list_args( $args ) {
$args['avatar_size'] = 90;
return $args;
}
/* =BEGIN: Check If Page Is Child
Source: http://bavotasan.com/2011/is_child-conditional-function-for-wordpress/
---------------------------------------------------------------------------------------------------- */
function is_child( $page_id_or_slug ) { // $page_id_or_slug = The ID of the page we're looking for pages underneath
global $post; // load details about this page
if ( !is_numeric( $page_id_or_slug ) ) { // Used this code to change a slug to an ID, but had to change is_int to is_numeric for it to work.
$page = get_page_by_path( $page_id_or_slug );
$page_id_or_slug = $page->ID;
}
@JiveDig
JiveDig / soliloquy_remove_stylesheet.php
Last active August 29, 2015 14:06 — forked from thomasgriffin/gist:7308584
Remove styling and stylesheets in Soliloquy Slider
<?php
add_action( 'tgmsp_before_slider_output', 'tgm_custom_slider_theme' );
function tgm_custom_slider_of_madness( $id ) {
// If not the proper slider ID, do nothing. Change to match your slider ID.
if ( '324' !== $id ) return;
// Dequeue the default styles.
wp_dequeue_style( 'soliloquy-style' );
@JiveDig
JiveDig / edd_shop_vendor_delete_products.php
Created July 10, 2014 14:27 — forked from pippinsplugins/functions.php
All Easy Digital Downloads shop vendors to delete products/downloads
<?php
function change_author_capabilities() {
$role = get_role( 'shop_vendor' ) ;
$role->add_cap( 'delete_published_products' );
}
add_action( 'admin_init', 'change_author_capabilities' );
<?php
function change_post_label() {
global $menu;
global $submenu;
$menu[5][0] = 'News';
$submenu['edit.php'][5][0] = 'News';
$submenu['edit.php'][10][0] = 'Add News';
$submenu['edit.php'][16][0] = 'News Tags';
<?php
function change_author_capabilities() {
$role = get_role( 'author' ) ;
$role->remove_cap( 'edit_published_posts' );
$role->remove_cap( 'publish_posts' );
$role->remove_cap( 'delete_published_posts' );
$role->remove_cap( 'edit_posts' );
$role->remove_cap( 'delete_posts' );
@JiveDig
JiveDig / auto_enroll.php
Created December 17, 2013 21:39 — forked from supercleanse/auto_enroll.php
Auto enroll/add new user to specific member or product in Memberpress
<?php
if(is_plugin_active('memberpress/memberpress.php')) {
add_action( 'user_register', 'mp_auto_enroll' );
//add_action( 'gform_user_registered', 'mp_auto_enroll', 10, 4 );
function mp_auto_enroll($user_id, $user_config=array(), $entry='', $user_pass='') {
$txn = new MeprTransaction();
$txn->user_id = $user_id;
@JiveDig
JiveDig / remove_genesis_widgets.php
Created May 10, 2013 19:29
Remove default/stock/standard Genesis widgets
<?php
// Remove eNews and Updates widget
add_action( 'widgets_init', 'remove_enews_updates_widget', 20 );
function remove_enews_updates_widget() {
unregister_widget( 'Genesis_eNews_Updates' );
}
// Remove Featured Page widget
add_action( 'widgets_init', 'remove_featured_page_widget', 20 );
<?php
// Customize search form input box text
add_filter( 'genesis_search_text', 'custom_search_text' );
function custom_search_text($text) {
return esc_attr( 'Search my blog...' );
}
// Customize search form input button text
add_filter( 'genesis_search_button_text', 'custom_search_button_text' );