Skip to content

Instantly share code, notes, and snippets.

View nucab's full-sized avatar
🏠
Working from home

Noah U nucab

🏠
Working from home
View GitHub Profile
@nucab
nucab / Mark parent navigation active when on custom post type single page Mark (highlight) custom post type parent as active item in Wordpress Navigation. When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
add_action('nav_menu_css_class', 'add_current_nav_class', 10, 2 );
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Getting the post type of the current post
@nucab
nucab / mu-plugin-yoast-seo-disable-notifications.php
Created May 4, 2016 23:03 — forked from wpchannel/mu-yoast-seo-disable-notifications.php
Hide annoying notifications after each upgrade of Yoast SEO plugin and others admin notices
<?php if (!defined('ABSPATH')) die('Restricted Area');
/*
* Plugin Name: Disable Yoast SEO Notifications
* Description: Hide annoying notifications after each upgrade of Yoast SEO plugin and others admin notices.
* Version: 1.1
* Author: Aurélien Denis
* Author URI: http://wpchannel.com/
*/
@nucab
nucab / functions.php
Created May 4, 2016 22:37 — forked from maddisondesigns/functions.php
Remove Yoast SEO nag after update
<?php
class ahRemoveYoastNag_Remove_Yoast_SEO_Nag {
private $yoastPluginFile;
public function __construct() {
$this->yoastPluginFile = "wordpress-seo/wp-seo.php";
/*
* jYoutube 1.0 - YouTube video image getter plugin for jQuery
*
* Copyright (c) 2009 jQuery Howto
*
* Licensed under the GPL license:
* http://www.gnu.org/licenses/gpl.html
*
* Plugin home & Author URL:
* http://jquery-howto.blogspot.com
@nucab
nucab / jquery.waituntilexists.js
Created February 2, 2016 15:08 — forked from buu700/jquery.waituntilexists.js
jQuery plugin which runs handler function once specified element is inserted into the DOM
(function ($) {
/**
* @function
* @property {object} jQuery plugin which runs handler function once specified element is inserted into the DOM
* @param {function} handler A function to execute at the time when the element is inserted
* @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound after its first invocation
* @example $(selector).waitUntilExists(function);
*/
@nucab
nucab / BVProductList.html
Created January 1, 2016 22:29 — forked from elmogallen/BVProductList.html
Inline Bazaarvoice Ratings and Reviews with Read Reviews link
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<!-- TODO:
Do some kind of loop here to show your results.
Inside the loop, you'd generate HTML similar to the following: -->
<div id="BVRRInlineRating-{productId}"></div>
<a href="" class="bvReadReviews" data-pid="{productId}">Read reviews</a>
<!-- End Loop That Generates HTML for results -->
@nucab
nucab / RRIntegrationCode.html
Created January 1, 2016 22:29 — forked from charleshimmer/RRIntegrationCode.html
Bazaarvoice RR integration code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<script src="//display-stg.ugc.bazaarvoice.com/static/Bazaarvoice/bvapi.js"></script>
<script>
@nucab
nucab / breadcrumbs.php
Created December 23, 2015 15:28 — forked from jazzsequence/breadcrumbs.php
WordPress SEO Breadcrumbs
/**
* SEO Breadcrumbs
* @author Chris Reynolds
* @link http://www.quickonlinetips.com/archives/2012/02/wordpress-seo-breadcrumbs/
* Search engine optimized breadcrumbs. Original source was taken from the link above, with changes made so that it supports pages as well as posts and integrates into Twitter Bootstrap breadcrumb styles
*/
function seo_breadcrumbs() {
// this sets up some breadcrumbs for posts & pages that support Twitter Bootstrap styles
$separator = ' <span class="divider">&rsaquo;</span>';
echo '<ul xmlns:v="http://rdf.data-vocabulary.org/#" class="breadcrumb">';
@nucab
nucab / js_google_fonts_async_ieshim
Last active September 13, 2015 00:58 — forked from kosmiq/js_google_fonts_async_ieshim
An updated version of Thomas Bensmanns Load Google Fonts via JS (https://bensmann.no/google-webfonts-performance/) with a SHIM for IE9 and IE8.
WebFontConfig = {
google: { families: [ \'Ek+Mukta:200,800:latin\' ] }
};
var cb = function() {
var wf = document.createElement(\'script\');
wf.src = \'//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js\';
wf.type = \'text/javascript\';
wf.async = \'true\';
var s = document.getElementsByTagName(\'script\')[0];
s.parentNode.insertBefore(wf, s);
@nucab
nucab / all-actions-list.php
Last active September 12, 2015 19:15 — forked from thefuxia/all-actions-list.php
Plugin All Actions List
<?php # -*- coding: utf-8 -*-
/*
Plugin Name: All Actions List
Description: Lists all actions run during one request.
Version: 1.0
Required: 3.1
Author: Thomas Scholz
Author URI: http://toscho.de
License: GPL
*/