Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris RevConcept

View GitHub Profile
@RevConcept
RevConcept / mbt_split_nav_walker_with_child_nav.php
Created Jun 2, 2017
An improvement on my original gist that splits the WordPress navigation into two menus (for sites with a centered logo for example). This version accounts for sites that are also using dropdown menus. It will only take the top level menu items into account when calculating the breakpoint location.
View mbt_split_nav_walker_with_child_nav.php
/* ==========================================================================
Custom Walker: Split menu based on item count
========================================================================== */
class mbt_split_nav_walker extends Walker_Nav_Menu {
var $current_menu = null;
var $break_point = null;
@RevConcept
RevConcept / functions.php
Last active Feb 20, 2016
Page View Cookie
View functions.php
/* ===========================================
Count LC Page Views
=============================================*/
function non_member_view_count() {
if ( !is_user_logged_in() ) {
if ( !isset($_COOKIE['lc_page_view']) ) {
$value = 1;
setcookie('lc_page_view', $value, time()+3600*24*100, '/', 'cardiacmri.com', false);
@RevConcept
RevConcept / attachment-cpt.php
Last active Aug 28, 2015
Adds thumbnail of attachment to admin columns and image preview to CPT admin post page. CPT in example is 'guest-photos'. Using this in addition to "Frontend Uploader" plugin (https://wordpress.org/plugins/frontend-uploader/)
View attachment-cpt.php
/* ===========================================
Show Guest Photo Attachment in CPT Admin Columns
=============================================*/
// GET ATTACHED IMAGE
function revcon_get_attachment_image($post_ID) {
$images = get_attached_media('image', $post_ID);
if ($images) {
View simplegrid.scss
/*
Simple Grid
Learn More - http://dallasbass.com/simple-grid-a-lightweight-responsive-css-grid/
Project Page - http://thisisdallas.github.com/Simple-Grid/
Author - Dallas Bass
Site - dallasbass.com
*/
*, *:after, *:before {
-webkit-box-sizing: border-box;
@RevConcept
RevConcept / recipet-query.php
Last active Aug 29, 2015
Conditional Query for Recipe Archive
View recipet-query.php
<?php // DEFAULT LOOP
if( (!isset($_POST['product_selection']) || '' == $_POST['product_selection']) && (!isset($_POST['cat_selection']) || '' == $_POST['cat_selection'] )) { ?>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$query = new WP_Query( array(
'post_type' => 'recipes', // your CPT
View filter-products.php
<?php
function recipe_product_filter() {
global $post;
// Query products
$query = new WP_Query(array(
'post_type' => 'recipes',
@RevConcept
RevConcept / mbt_split_nav_walker.php
Last active Feb 5, 2021
WordPress Custom Walker: Split menu based on item count
View mbt_split_nav_walker.php
/* ==========================================================================
Custom Walker Menu
========================================================================== */
class mbt_split_nav_walker extends Walker_Nav_Menu {
var $current_menu = null;
var $break_point = null;
function start_el(&$output, $item, $depth, $args) {
View profile-change-notice.php
<?php
/* ===========================================
Send Emails when User Profile Changes
=============================================*/
// IF EMAIL CHANGES
function sr_user_profile_update_email( $user_id, $old_user_data ) {
$user = get_userdata( $user_id );
@RevConcept
RevConcept / functionality.php
Created Mar 4, 2014
Adding custom icons to ACF radio buttons.
View functionality.php
/* ===========================================
Radio Button Icons in Admin for ACF
=============================================*/
function sr_acf_radio_style() {
echo '<link rel="stylesheet" href="' . plugins_url( 'css/jazz.css', __FILE__) . '" type="text/css" media="screen" />';
}
add_action('admin_head', 'sr_acf_radio_style');
@RevConcept
RevConcept / revcon_get_images
Created Jan 29, 2014
WordPress: Display All Post Attachment Images In A Slider. Original post here: http://revelationconcept.com/wordpress-display-all-post-attachment-images-in-a-slider
View revcon_get_images
// This is modified to show the image captions
function revconcept_get_images($post_id) {
global $post;
$thumbnail_ID = get_post_thumbnail_id();
$images = get_children( array('post_parent' => $post_id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
if ($images) :