Skip to content

Instantly share code, notes, and snippets.

@tddewey
tddewey / _mixin-optical-center.scss
Created August 20, 2014 18:44
Optical Centering Mixin
// optical-center
//
// Provide this mixin a padding value that you might normally apply equally to
// top and bottom padding on an element (e.g. so its contents are centered).
//
// It will, instead, give a bit more padding to the bottom and a bit less to the top so
// the element appears optically centered and takes up the same amount of room.
//
// The amount of padding that goes to the bottom vs the top is controlled by a second
// $ratio parameter that defaults to 1.3
@norcross
norcross / yoast-ga-menu-move.php
Last active August 29, 2015 14:06
move Yoast Google Analytics top-level nav to a sub menu
/**
* move the main settings page for Yoast Google Analytics
* from it's own parent menu into a submenu page in either
* the Yoast SEO menu or in the general settings
*
* @return null
*/
function rkv_yoast_ga_menu() {
// check for the Yoast GA class in the event the plugin
@sbone
sbone / foundation-5-bookmarklet-styles.css
Last active August 29, 2015 14:18
CSS for JS bookmarklet that shows which breakpoint Foundation 5 is reading
#foundation-breakpoint-indicator:before {
content: 'NULL';
display: block;
position: fixed;
top: 0;
left: 50%;
margin-left: -50px;
width: 100px;
background-color: blue;
text-align: center;
@tammyhart
tammyhart / traverse_results.php
Last active August 29, 2015 14:20
Traverse WordPress Search Results
<?php
/**
* Return search array
*/
function loopconf_search_array( $search_hash ) {
// check for existence of unique transient
if ( false === ( $search_array = get_transient( 'loopconf_search_' . $search_hash ) ) ) {
global $wpdb;
@Steveorevo
Steveorevo / wp-config.php
Created July 12, 2012 10:54
Sync DesktopServer local/live wp-config.php without overwrite worries
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
//Update sponsor count
add_action("gform_after_submission_9", "update_sponsor_count_9", 10, 2);
function update_sponsor_count_9($entry, $form) {
//getting post and entry data
$sponsor_level = $entry["3"];
$post_num = $entry["12"];
$sponsors = get_post_meta($post_num, 'sponsors' , true);
<?php
//Setup data to include in the form
if ( have_posts() ) while ( have_posts() ) : the_post();
$child_name=get_the_title();
$child_id=get_field('listing_code');
$sponsor_count = get_field('sponsors');
if (h1n_in_taxonomy('status', 'orphaned') || h1n_in_taxonomy('status', 'teacher')) {
$slots=5;
<?php
/**
* Rename "Posts" to "News"
*
* @link http://new2wp.com/snippet/change-wordpress-posts-post-type-news/
*/
add_action( 'admin_menu', 'engage_change_post_menu_label' );
add_action( 'init', 'engage_change_post_object_label' );
function engage_change_post_menu_label() {
@gmazzap
gmazzap / CptInMainQueryByMeta.php
Created January 10, 2014 14:42
Simlpe plugin coded to refactor the code posted on a WPSE anwser
<?php
/**
* Plugin Name: Cpt In Main Query By Meta
* Plugin URI: http://wordpress.stackexchange.com/questions/129236/
* Description: Allow mixing a post type with another on main query, only if the second match some meta query args
* Author: Giuseppe Mazzapica
* Author URI: http://wordpress.stackexchange.com/users/35541/g-m
*/
@mathetos
mathetos / smart-excerpts
Last active May 17, 2016 19:43
Smart Excerpts
<?php
/*
* This asks first for a Yoast SEO meta description,
* If that's not present, then it asks for the excerpt of the post,
* If that's not present, then it strips the content
* In this case, I have an excerpt length setting in the Customizer
* Both the excerpt and content stripping, also strip shortcodes
* @author Matt Cromwell <reachme@mattcromwell.com>
* @copyright Copyright (c) 2014, Matt Cromwell
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License