Skip to content

Instantly share code, notes, and snippets.

View yumyo's full-sized avatar

Giulia Nicole Pernice yumyo

View GitHub Profile
@jchristopher
jchristopher / gist:8558947
Created January 22, 2014 13:44
Tell SearchWP to index author information by adding it to SearchWP's index as postmeta
<?php
function my_searchwp_extra_metadata( $extra_meta, $post_being_indexed ) {
// available author meta: http://codex.wordpress.org/Function_Reference/get_the_author_meta
// retrieve the author's name(s)
$author_nicename = get_the_author_meta( 'user_nicename', $post_being_indexed->post_author );
$author_display_name = get_the_author_meta( 'display_name', $post_being_indexed->post_author );
$author_nickname = get_the_author_meta( 'nickname', $post_being_indexed->post_author );
@hereswhatidid
hereswhatidid / clean-walker.php
Last active February 5, 2021 16:14
WordPress nav walker that strips the WP generated styles and IDs from the generated output.
<?php
class Clean_Walker_Nav extends Walker_Nav_Menu {
/**
* Filter used to remove built in WordPress-generated classes
* @param mixed $var The array item to verify
* @return boolean Whether or not the item matches the filter
*/
function filter_builtin_classes( $var ) {
return ( FALSE === strpos( $var, 'item' ) ) ? $var : '';
}
@trajche
trajche / functions.php
Last active December 22, 2023 10:54
Remove Yoast SEO version from header
add_action('get_header', 'start_ob');
add_action('wp_head', 'end_ob', 999);
function start_ob() {
ob_start('remove_yoast');
}
function end_ob() {
ob_end_flush();
}
@fardog
fardog / functions.php
Last active February 5, 2017 19:46
A function for sending Wordpress Advanced Custom Fields (ACF) Repeater Field, Flexible Content Field, Gallery Field data with Thermal API.
<?php
function north_cast_api_data($content) {
if (is_numeric($content)) $content = intval($content);
else {
$unserialized_content = @unserialize($content);
// we got serialized content
if ($unserialized_content !== false) {
// make sure that integers are represented as such, instead of str
foreach ($unserialized_content as $fn => &$c) {
@chriskoelle
chriskoelle / nh-oembed.php
Last active December 15, 2015 19:43
Wordpress oEmbed Customizations
<?php
/**
* Clear oEmbed Cache on save
* this is necessary in order to update the oembed output
*/
function nh_clear_oembed_caches($post_id) {
if ( wp_is_post_revision( $post_id ) ) return;
global $wp_embed;
$wp_embed->delete_oembed_caches($post_id);
}
@wturrell
wturrell / popular-posts.php
Created March 14, 2014 12:33
Wordpress & Google Analytics - retrieve most popular posts
@natelandau
natelandau / .bash_profile
Last active May 12, 2025 15:55
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@scofennell
scofennell / sjf_deh_save_custom_meta.php
Last active June 20, 2017 16:06
WordPress function to save custom meta box for attachment posts
<?php
/**
* Save the Data
*
*/
function sjf_deh_save_custom_meta( $post_id ) {
// Check if the nonce exists.
if( ! isset( $_POST[ 'sjf_deh_custom_meta_box_nonce' ] ) ) { return $post_id; }
@joelstein
joelstein / _mixins.scss
Last active February 1, 2017 13:33
Horizontal list mixins
// Standard horizontal list, using word-spacing trick to remove whitespace
// between inline-block elements.
@mixin horizontal-list {
padding: 0;
text-align: center;
word-spacing: -1em;
display: table;
width: 100%;
li {
@fitzhaile
fitzhaile / bem-nav.php
Last active April 17, 2017 15:26
Alternative BEM-based lib/nav.php for Roots Theme
<?php
/**
* Cleaner, BEM-based walker for wp_nav_menu()
*
* (Attempts to adhere more to http://cssguidelin.es.)
*
* NOTE: This apprroach requires substitute arguments to be passed to wp_nav_menu().
*
* 'nav_class' - Class attached to the <nav> element that contains the menu.
* It is used to generate classes for the ul, li and anchor elements. For example,