Skip to content

Instantly share code, notes, and snippets.

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

Noah U nucab

🏠
Working from home
  • Philippines
  • 05:26 (UTC +08:00)
  • LinkedIn in/nucab
View GitHub Profile
@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);
*/
/*
* 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 / 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";
@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/
*/
var fs = require('fs');
var uglify = require('uglify-js').minify;
var pkg = require('./package');
fs.writeFileSync('dist/flexibility.js', [
'/*! Flexibility ',
pkg.version,
' | ',
pkg.license,
' Licensed | github.com/',
if(! empty( $item->url ) && $item->url !== '#') {
unset($atts['data-toggle']);
unset($atts['class']);
unset($atts['aria-haspopup']);
}
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
/**
* Custom PayPal button text
*
*/
add_filter( 'gettext', 'ld_custom_paypal_button_text', 20, 3 );
function ld_custom_paypal_button_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Proceed to PayPal' :
$translated_text = __( 'Buy Now', 'woocommerce' );
break;
@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
// User defined code goes here
window.onload = function(e) {
console.log('window loaded!');
parent.API.toggleContinueButton();
};