Skip to content

Instantly share code, notes, and snippets.

View ejntaylor's full-sized avatar
🚢
Shipping

Elliot ejntaylor

🚢
Shipping
View GitHub Profile
<?php
function ss_list_array() {
// Set Vars
$current_user = get_current_user();
$username = $current_user->user_login;
$post = get_the_ID();
<?php
// cmb2
// hook the function to the cmb2_init action
add_action( 'cmb2_init', 'cmb2_sample_metaboxes' );
// create the function that creates metaboxes and populates them with fields
function cmb2_sample_metaboxes() {
add_shortcode( 'ss-site-form', 'ss_frontend_form_shortcode' );
/**
* Shortcode to display a CMB2 form for a post ID.
* @param array $atts Shortcode attributes
* @return string Form HTML markup
*/
function ss_frontend_form_shortcode( $atts = array() ) {
global $post;
@ejntaylor
ejntaylor / functions.php
Last active January 3, 2021 10:59
WooCommerce subscriptions without credit card
<?php
// Free Trial - Let GF Reg use email as username
/**
* WordPress register with email only, make it possible to register with email
* as username in a multisite installation
* @param Array $result Result array of the wpmu_validate_user_signup-function
* @return Array Altered result array
*/
function custom_register_with_email($result) {
@ejntaylor
ejntaylor / functions.php
Last active August 29, 2015 14:27
Layers - Jetpack Infinite Scroll Support (attempts)
<?php
// infinite scroll support
add_theme_support( 'infinite-scroll', array(
'container' => 'content',
'footer' => true,
'wrapper' => true,
'type' => 'click',
@ejntaylor
ejntaylor / style.css
Created July 3, 2015 10:07
WooCommerce Tax Toggle Mobile CSS
/* Portrait and Landscape */
@media only screen
and (min-device-width: 320px)
and (max-device-width: 480px)
and (-webkit-min-device-pixel-ratio: 2) {
#wcvat-toggle {
position: fixed;
bottom: 0;
@ejntaylor
ejntaylor / gist:0bb59dca0afc8a2b83d6
Created June 17, 2015 07:52
OBox Layers - Adds comment to featured image function
/**
* Post Featured Media
*
* @param int $attachmentid ID for attachment
* @param int $size Media size to use
* @param int $video oEmbed code
*
* @return string $media_output Feature Image or Video
*/
@ejntaylor
ejntaylor / functions.php
Created May 12, 2015 20:40
ReOrder LayersWP Child Style Load Order
<?php
// Remove Layers added Child Styles
add_action( 'wp_enqueue_scripts', 'remove_default_layers_child_stylesheet', 20 );
@ejntaylor
ejntaylor / functions.php
Created March 20, 2015 10:55
Example: Add SEO content to home page
<?php
// add home page content
add_action ('after_primary','custom_homepage_content');
function custom_homepage_content() {
if (is_front_page()) {
@ejntaylor
ejntaylor / functions.php
Created November 11, 2014 12:44
Get the icon image from the WordPress Plugin API
<?php
$bp_filetypes = array('128x128.png','128x128.jpg','256x256.png','256x256.jpg','logo.svg');
foreach ($bp_filetypes as $bp_filetype) {
$logo_item = $bp_filetype;
$url = 'http://ps.w.org/' . $pb_plugin_item[plugin_slug] . '/assets/icon-' . $logo_item;
//echo $url;