Skip to content

Instantly share code, notes, and snippets.

Avatar

Dylan Ryan irkanu

View GitHub Profile
@irkanu
irkanu / gist:ca4cab39a85359aea4972862daa95f38
Created Jun 25, 2018 — forked from sabarasaba/gist:3080590
Remove directory from remote repository after adding them to .gitignore
View gist:ca4cab39a85359aea4972862daa95f38
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@irkanu
irkanu / example.html
Created Aug 18, 2016
VWO executeTrackingCode() Example
View example.html
<script type="text/javascript">
window._vis_opt_url = '#!/pricing';
executeTrackingCode();
</script>
@irkanu
irkanu / fs-my-addon.php
Created May 13, 2016 — forked from vovafeldman/fs-my-addon.php
Example of an add-on with Freemius that is activated only when the parent plugin is activated and loaded.
View fs-my-addon.php
<?php
/*
Plugin Name: My Add-on
Version: 1.0.0
Author: Vova Feldman
Author URI: http://freemius.com
License: GPL2
*/
// Exit if accessed directly
@irkanu
irkanu / vwo_example.js
Created May 9, 2016
An AngularJS routing work around provided by VWO support.
View vwo_example.js
var ele1_interval = setInterval(function(){
// VWO code here - for example:
// vwo_$("#price-monthly").html("14");
}, 100);
@irkanu
irkanu / functions.php
Last active Jan 7, 2016
Reposition the The Events Calendar gCal and iCal buttons before the content.
View functions.php
/**
* Reposition the The Events Calendar gcal and ical buttons before the content.
*
* https://wordpress.org/plugins/the-events-calendar/
*/
remove_action( 'tribe_events_single_event_after_the_content', array( 'Tribe__Events__iCal', 'single_event_links' ) );
add_action( 'tribe_events_single_event_before_the_content', 'theme_reposition_calendar_buttons' );
function theme_reposition_calendar_buttons() {
// don't show on password protected posts
if ( is_single() && post_password_required() ) {
@irkanu
irkanu / dequeue_learndash.php
Last active Feb 3, 2021
Dequeue LearnDash scripts on the homepage.
View dequeue_learndash.php
/**
* Remove the LearnDash related scripts / styles from the homepage.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_learndash_styles', 99 );
function child_manage_learndash_styles() {
// Check if LearnDash exists to prevent fatal errors.
if ( class_exists( 'SFWD_LMS' ) ) {
// Make sure we are on the front page.
@irkanu
irkanu / example.php
Created Jul 16, 2015
example post date shortcode filter
View example.php
add_filter( 'genesis_post_date_shortcode', 'example_custom_date_shortcode' );
function example_custom_date_shortcode( $atts ) {
$custom_date = the_date( 'Y-m-d', '<p class="custom-date">', '</p>' );
$atts = array(
'after' => '',
'before' => '',
'format' => $custom_date,
'label' => '',
@irkanu
irkanu / example.php
Created Jul 16, 2015
Trying to redirect to checkout only if the product has a "Trial" category.
View example.php
add_filter( 'woocommerce_add_to_cart_redirect', 'example_redirect_to_checkout' );
function example_redirect_to_checkout() {
$redirect_url = WC()->cart->get_checkout_url();
if ( is_product() && has_term( 'Trial', 'product_cat' ) ) {
return $redirect_url;
}
}
@irkanu
irkanu / 0-readme
Last active Aug 29, 2015
A proposed change for the get_sortable_columns() function in class-wp-plugins-list-table.php.
View 0-readme
Currently, WordPress has hooks and filters available to add columns and rows to screens. ie: plugin, post, pages, etc.
Add custom columns hook: manage_{screen->id}_columns
Add custom row data filter: manage_plugins_custom_column
However, to make those columns sortable you must reference the key-value entries manage_{screen->id}_columns
in get_sortable_columns() for the specific screen. ie: class-wp-plugins-list-table.php Line 263 shown below.
The only way to modify that value is to edit core. I believe we should filter the returned array. That will
allow developers to specify whether or not their custom columns are sortable.
@irkanu
irkanu / custom-nav-walker.php
Created Jul 10, 2015
Custom Navigation Walker
View custom-nav-walker.php
class primary_navigation_schema_rewrite extends Walker_Nav_Menu {
// add classes to ul sub-menus
function start_lvl( &$output, $depth = 0, $args = array() ) {
// depth dependent classes
$indent = ( $depth > 0 ? str_repeat( "\t", $depth ) : '' ); // code indent
$display_depth = ( $depth + 1); // because it counts the first submenu as 0
$classes = array(
'sub-menu',
( $display_depth % 2 ? 'menu-odd' : 'menu-even' ),