Skip to content

Instantly share code, notes, and snippets.

View JiveDig's full-sized avatar

Mike Hemberger JiveDig

View GitHub Profile
@JiveDig
JiveDig / acf-pricing-table.css
Last active February 8, 2021 17:18
ACF Pro json file to create a pricing table field group
/* Pricing Table
--------------------------------------------- */
.pricing-table {
box-sizing: border-box;
display: -webkit-flex;display: -ms-flexbox;display: flex;
-webkit-flex: 0 1 auto;-ms-flex: 0 1 auto;flex: 0 1 auto;
-webkit-flex-wrap: wrap;-ms-flex-wrap: wrap;flex-wrap: wrap;
-webkit-flex-direction: row;-ms-flex-direction: row;flex-direction: row;
-webkit-justify-content: space-between;-ms-flex-pack: justify;justify-content: space-between;
@JiveDig
JiveDig / wp-edit-post-front-end.php
Last active July 24, 2024 18:03
Filter WP 'Edit Post' link to go to front end /edit-post/ page with ?post_id=123 query arg to allow editing posts via the front end
<?php
/**
* Filter WP 'Edit Post' link to go to front end /edit-post/ page
*
* @author Mike Hemberger
* @link http://thestizmedia.com/front-end-post-editing-with-caldera-forms/
* @return string url to front end for with query arg source post ID ( ?post_id=123 )
*/
add_filter( 'get_edit_post_link', 'tsm_edit_post_link', 10, 1 );
@JiveDig
JiveDig / edit-post-link-query-arg.php
Last active September 16, 2020 19:13
Add a custom 'Edit Post' link on posts the logged in user authored.Uses tsm_is_current_users_post( $post_id ) helper function here https://gist.github.com/JiveDig/c2d59c4efd996c41dd23. Adds ?post_id=123 query arg to the end of a page URL
<?php
/**
* Add a custom 'Edit Post' link on posts the logged in user authored
* Links to a separate page with ?post_id=123 query string
* Uses tsm_is_current_users_post( $post_id ) helper function
*
* @author Mike Hemberger
* @link http://thestizmedia.com/front-end-post-editing-with-caldera-forms/
* @return bool/string false or edit post link
@JiveDig
JiveDig / is-current-users-post.php
Last active January 20, 2021 16:19
Helper function to check if the currently logged in user is the author of a specific post, by post ID
<?php
/**
* Helper function to check if a user is the author of a specific post
*
* @author Mike Hemberger
* @link http://thestizmedia.com/front-end-post-editing-with-caldera-forms/
* @param int $post_id Post ID
* @return bool
*/
@JiveDig
JiveDig / caldera-edit-post-form.php
Last active October 19, 2015 16:13
Creates a shortcode to conditionally display a form if the current user is the author of the post they're trying to edit.
<?php
/**
* Shortcode to conditionally display a post edit form
*
* @author Mike Hemberger
* @link http://thestizmedia.com/front-end-post-editing-with-caldera-forms/
* @uses Caldera Forms
* @return mixed Access message or Caldera Form
*/
add_shortcode( 'edit_post', 'tsm_do_caldera_edit_post_form' );
@JiveDig
JiveDig / multiple_pricing.php
Last active September 10, 2015 15:51
This is an updated version of EDD's FES multiple pricing field (beta 2.3). It adds some filters to allow developers to add new columns to the pricing rows. Also, rewrites some of the code in the `if ( $post_id ) {` section of the render_field_frontend() function.
<?php
class FES_Multiple_Pricing_Field extends FES_Field {
/** @var bool For 3rd parameter of get_post/user_meta */
public $single = false;
/** @var array Supports are things that are the same for all fields of a field type. Like whether or not a field type supports jQuery Phoenix. Stored in obj, not db. */
public $supports = array(
'multiple' => false,
'forms' => array(
@JiveDig
JiveDig / child-pages-acf-map.php
Last active November 12, 2015 21:39
Create shortcode to display map of all child page locations
<?php // Put this code in functions.php or a custom plugin. Don't include opening php tag
/**
* Create shortcode to display map of all child page locations
*
* @author Mike Hemberger
* @link http://thestizmedia.com/shortcode-to-show-map-markers-of-child-pages-with-acf-pro/
*
* @return mixed
*/
(function($) {
/*
* render_map
*
* This function will render a Google Map onto the selected jQuery element
*
* @type function
* @date 8/11/2013
* @since 4.3.0
@JiveDig
JiveDig / sensible-script-enqueuing.php
Last active August 29, 2015 14:25
Sensible script enqueueing - http://mikejolley.com/2013/12/sensible-script-enqueuing-shortcodes/ - use wp_enqueue_script('script-name'); in your shortcode.
<?php // Put this code in functions.php or a custom plugin. Don't include opening php tag.
/**
* Register scripts to enqueue in our shortcode
* @author Mike Hemberger
* @link http://thestizmedia.com/shortcode-to-show-map-markers-of-child-pages-with-acf-pro/
*/
add_action('wp_enqueue_scripts', 'tsm_register_non_global_scripts');
function tsm_register_non_global_scripts() {
wp_register_script( 'google-map', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false', array(), '3', true );
@JiveDig
JiveDig / acf-form-sidr.css
Last active August 29, 2015 14:15
CSS for Sidr with ACF front end form in it
.sidr {
display: none;
position: fixed;
top: 0;
height: 100%;
width: 100%;
max-width: 500px;
left: -500px;
right: auto;
background: #fff;