Skip to content

Instantly share code, notes, and snippets.

View JiveDig's full-sized avatar

Mike Hemberger JiveDig

View GitHub Profile
@JiveDig
JiveDig / acf_front_end_edit.php
Last active July 24, 2024 18:03
ACF front end post editing
<?php
/**
* Check if user is logged in and is post author
* Setup functions for front end post editing
* @author Mike Hemberger
* @link http://thestizmedia.com/front-end-post-editing-with-acf-pro/
* @uses Advanced Custom Fields Pro
* @uses Sidr
*/
@JiveDig
JiveDig / sidr_edit_post.js
Created February 17, 2015 21:06
Front end post editing with Sidr
( function ( document, $, undefined ) {
'use strict';
// Initiate side menu
$( '#edit-toggle' ).sidr({
name: 'edit-post',
side: 'left',
renaming: false,
// displace: false,
onOpen: function() {
@JiveDig
JiveDig / acf_create_posts_acf_form.php
Last active February 28, 2023 06:29
Page template to create posts on the front end via Advanced Custom Fields Pro
<?php
/**
* Template Name: Create Post
*
* @author Mike Hemberger
* @link http://thestizmedia.com/front-end-posting-with-acf-pro/
* @uses Advanced Custom Fields Pro
*/
/**
/* 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;
}
@JiveDig
JiveDig / admin_columns.php
Last active August 29, 2015 14:09
Add custom admin sortable columns
<?php
add_filter( 'manage_edit-resident_columns', 'set_custom_edit_resident_columns' );
add_action( 'manage_resident_posts_custom_column' , 'custom_resident_column', 10, 2 );
function set_custom_edit_resident_columns($columns) {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => 'Title',
'display' => 'Display',
@JiveDig
JiveDig / remove_toolbar.php
Created November 7, 2014 16:24
Remove toolbar from front end
<?php
//* Remove toolbar from frontend and remove CSS that bumps content down
add_filter( 'show_admin_bar', 'bhl_hide_admin_bar_from_front_end' );
function bhl_hide_admin_bar_from_front_end(){
if ( ! current_user_can('manage_options') ) {
return false;
// Remove CSS
remove_action( 'wp_head', '_admin_bar_bump_cb' );
@JiveDig
JiveDig / disable_toolbar.php
Created October 9, 2014 16:38
Diable toolbar for non admins
<?php
//* Disable toolbar for non admins
add_action('after_setup_theme', 'mwm_remove_admin_bar');
function mwm_remove_admin_bar() {
if ( !current_user_can('administrator') && !is_admin() ) {
show_admin_bar(false);
}
}
@JiveDig
JiveDig / stay_logged_in.php
Created October 9, 2014 16:34
// Stay logged in
<?php
// Stay logged in
add_filter( 'auth_cookie_expiration', 'mwm_keep_me_logged_in_for_4_weeks' );
function mwm_keep_me_logged_in_for_4_weeks( $expirein ) {
return 2419200; // 4 weeks in seconds
}
@JiveDig
JiveDig / redirect_login.php
Created October 9, 2014 12:29
Redirect login and registration form to front end page
<?php
// Redirect wp-login.php to custom url
add_action( 'login_form_login', 'mwm_redirect_login' );
function mwm_redirect_login() {
wp_redirect( home_url() );
exit();
}
// Redirect wp-login.php?action=register to custom url