Skip to content

Instantly share code, notes, and snippets.

Nic Ford nicdford

Block or report user

Report or block nicdford

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nicdford
nicdford / gist:adcb40396eaffadf242636a3936a5172
Created Sep 5, 2019
Shortcode to display posts headlines by category
View gist:adcb40396eaffadf242636a3936a5172
[wsuwp_json host="provost.wsu.edu" category="faculty-development" count="10" output="headlines" cache_bust="0"]
View gist:7b5dcf3b44431e590057626aa69578c2
/**
* Create excerpt from content
*/
function pac_create_exerpt( $content ) {
return wp_trim_words($content, 15, '...');
}
@nicdford
nicdford / gist:a19eec2de96209e319ab0eabb8721109
Created Mar 20, 2018
Custom Simple Relationship where param list pods values
View gist:a19eec2de96209e319ab0eabb8721109
<?php
$params = array(
'limit' => 3,
'where' => "source.meta_value = 'google'" // Relationship (Custom Simple)
);
$pods = pods( 'testimony', $params );
if ( !empty( $pods ) ) {
while ($pods->fetch()){
@nicdford
nicdford / gist:9e715f9661aa6fd0f688cc03c6e8064b
Created May 4, 2016
Add Pods Shortcode Wizard to Beaver Builder Text Editer Module
View gist:9e715f9661aa6fd0f688cc03c6e8064b
function show_pods_modal_button() {
$fl_builder = pods_v('fl_builder', 'get', 'url');
if (empty($fl_builder)) {
pods_view( PODS_DIR . 'ui/admin/shortcode.php', compact( array_keys( get_defined_vars() ) ) );
echo '<a href="#TB_inline?width=640&inlineId=pods_shortcode_form" class="thickbox button" id="add_pod_button" title="Pods Shortcode"><img style="padding: 0px 6px 0px 0px; margin: -3px 0px 0px;" src="' . PODS_URL . 'ui/images/icon16.png" alt="' . __('Pods Shortcode' ,'pods') . '" />' . __('Pods Shortcode' ,'pods') . '</a>';
}
}
@nicdford
nicdford / page-resources.php
Created Dec 3, 2015
A Pods Example on running a loop inside a loop.
View page-resources.php
<?php
/**
* Template Name: Library Resource List
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package asotin_county_library
@nicdford
nicdford / filters
Last active Feb 24, 2016
filters setup
View filters
<?php
$things_to_do = pods( 'things_to_do' );
$limit = 9;
$params = array(
'fields' => array(
'region',
'activity',
'legend_items'
),
@nicdford
nicdford / gulpfile.js
Created Sep 14, 2015
An example of a setup gulpfile to help speed up setup time for gulp driven projects
View gulpfile.js
var gulp = require('gulp');
var sass = require('gulp-sass');
var watch = require('gulp-watch');
var iconify = require('gulp-iconify');
var autoprefixer = require('gulp-autoprefixer');
var googleWebFonts = require('gulp-google-webfonts');
var browserSync = require( 'browser-sync' );
var reload = browserSync.reload;
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
@nicdford
nicdford / page-thing-to-do.php
Created Jul 30, 2015
A page using Pods filters() and other handy functions
View page-thing-to-do.php
<?php
/**
* Template Name: Things to Do
*
* @package visitnci
*/
get_header(); ?>
<div id="primary" class="content-area">
@nicdford
nicdford / custom_shortcode_w_pods
Last active Aug 29, 2015
A custom shortcode that makes a pods query and returns the value when the shortcode is called.
View custom_shortcode_w_pods
// Display Wine Items
function cc_display_wine( $atts ) {
// Attributes
extract( shortcode_atts(
array(
'wine_id' => '1',
), $atts )
);
@nicdford
nicdford / disable_yoast_on_admin
Last active Aug 29, 2015
Conditionally disable the Yoast Page Analysis on admin edit screens.
View disable_yoast_on_admin
/**
* Helper function to determine if we're on the right edit screen.
*
* @global $pagenow
* @param $post_types array() optional post types we want to check.
* @return bool
*/
function prefix_is_edit_screen( $post_types = '' ) {
if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
You can’t perform that action at this time.