Skip to content

Instantly share code, notes, and snippets.

Robin Cornett robincornett

Block or report user

Report or block robincornett

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@robincornett
robincornett / twitter-modification.php
Created Apr 23, 2019
Add a hashtag to all Twitter sharing buttons on a site (in Scriptless 3.0.0)
View twitter-modification.php
<?php
add_filter( 'scriptlesssocialsharing_twitter_query_args', 'prefix_add_twitter_hashtag_scriptless' );
/**
* Add a hashtag to every Twitter button on a site.
* Requires Scriptless Social Sharing 3.0.0
*
* @param $query_args
* @return mixed
*/
@robincornett
robincornett / functions.php
Created Mar 4, 2019
Use Simple Social Icons' SVG in Scriptless Social Sharing. Note: unless you are enqueueing the SSI CSS/JS independently, these will only work on pages where an instance of the SSI widget is being output.
View functions.php
<?php
add_filter( 'scriptlesssocialsharing_link_markup', 'prefix_modify_scriptless_link_markup', 10, 2 );
/**
* Add SVG icons to Scriptless sharing buttons.
*
* @param $output
*
* @param $button
*
@robincornett
robincornett / functions.php
Created Jan 30, 2019
Sample code to add Facebook Messenger as a sharing button to Scriptless Social Sharing.
View functions.php
<?php
add_filter( 'kses_allowed_protocols', 'prefix_allow_messenger' );
/**
* Add Facebook Messenger to the list of allowed URL protocols in WordPress.
*
* @param $protocols
*
* @return array
*/
@robincornett
robincornett / pocket.php
Last active Dec 17, 2018
Add a button for Pocket to Scriptless Social Sharing.
View pocket.php
<?php
add_filter( 'scriptlesssocialsharing_pocket_url', 'prefix_add_pocket', 10, 3 );
/**
* Create the URL for the Pocket share/save button.
*
* @param $url
* @param $button
* @param $attributes
*
@robincornett
robincornett / woocommerce.php
Created Jun 27, 2018
Code snippet to add the WooCommerce cart quantity and total to a SuperSide Me custom cart button.
View woocommerce.php
<?php
add_filter( 'supersideme_custom_buttons', 'prefix_add_woocommerce_quantity_total_button' );
/**
* Add the WooCommerce quantity and total to a shopping cart button.
*
* @param $buttons
*
* @return mixed
*/
@robincornett
robincornett / update.txt
Last active May 31, 2018
Updated responsive, mobile first, accessible, navigation menus for Genesis child themes. Uses SVG icons, and submenu toggle buttons on all screens. Submenus open on click/keypress/hover, but can be bypassed. Do not include Genesis support for accessible menus. Accommodations for no-JS users.
View update.txt
now located at: https://github.com/robincornett/leaven-responsive-menu
@robincornett
robincornett / svg-get.php
Last active May 8, 2018
Output SVG icons in shortcodes.
View svg-get.php
<?php
/**
* Build the string/markup for an SVG icon.
*
* @param $icon
*
* @param array $args
*
* @return string
@robincornett
robincornett / plugins-supersideme.php
Created May 7, 2018
Suggested/optional code for multisite and SuperSide Me, if the preference is to use the same settings on all sites in the network.
View plugins-supersideme.php
<?php
// Disable the SuperSide Me settings page and customizer panel on child sites
if ( ! is_main_site() ) {
add_filter( 'supersideme_disable_customizer_panel', '__return_true' );
add_filter( 'supersideme_disable_settings_page', '__return_true' );
}
add_filter( 'supersideme_get_plugin_setting', 'prefix_supersideme_use_main_site_setting', 20 );
/**
@robincornett
robincornett / plugins-scriptlesssocialsharing.php
Last active May 7, 2018
Change Scriptless Social Sharing links to use SVG icons instead of CSS pseudo elements
View plugins-scriptlesssocialsharing.php
<?php
add_filter( 'scriptlesssocialsharing_link_markup', 'leaven_modify_scriptless_link_markup', 10, 2 );
/**
* Add SVG icons to Scriptless sharing buttons.
*
* @param $output
*
* @param $button
*
@robincornett
robincornett / supersideme-svg_01.php
Last active Mar 8, 2018
Tell SuperSide Me (2.4.0) to use your theme's SVG icons.
View supersideme-svg_01.php
<?php
add_filter( 'supersideme_svg', 'leaven_prefer_theme_svg' );
/**
* Tell SuperSide Me not to load any icons.
* @param $args
*
* @return mixed
*/
function leaven_prefer_theme_svg( $args ) {
You can’t perform that action at this time.