Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

brodie broros

🎯
Focusing
  • company
  • world
View GitHub Profile
@broros
broros / jailkit
Created Feb 10, 2019 — forked from psyray/jailkit
Jailkit for Debian Stretch (add PHP, Drush, Composer, NodeJS, NPM, Ruby, Gem, Compass)
View jailkit
[php]
comment = the php interpreter and libraries
executables = /usr/bin/php,/usr/bin/php5.6,/usr/bin/php7.0,/usr/bin/php7.1
directories = /usr/lib/php, /usr/share/php, /usr/share/php5, /etc/php, /usr/share/php-geshi, /usr/share/zoneinfo, /etc/snmp, /usr/share/snmp
includesections = env
[env]
comment = environment variables
executables = /usr/bin/env
@broros
broros / repeatable-fields-metabox.php
Created Oct 1, 2017 — forked from helen/repeatable-fields-metabox.php
Repeating Custom Fields in a Metabox
View repeatable-fields-metabox.php
<?
/**
* Repeatable Custom Fields in a Metabox
* Author: Helen Hou-Sandi
*
* From a bespoke system, so currently not modular - will fix soon
* Note that this particular metadata is saved as one multidimensional array (serialized)
*/
function hhs_get_sample_options() {
View add-custom-menu-item-and-endpoint-to-woocommerce-my-account-page.php
/* Add custom menu item and endpoint to WooCommerce My-Account page */
function my_custom_endpoints() {
add_rewrite_endpoint( 'refunds-returns', EP_ROOT | EP_PAGES );
}
add_action( 'init', 'my_custom_endpoints' );
function my_custom_query_vars( $vars ) {
$vars[] = 'refunds-returns';
@broros
broros / gist:c8e9c05448cb777699628b937694f5bc
Created Jul 17, 2017 — forked from jaredatch/gist:1562aa6de1bc33db0bb3
Change author box title text in Genesis
View gist:c8e9c05448cb777699628b937694f5bc
<?php
/**
* Change "About" text in author box titles for single posts
*
* @since 1.0.0
* @param string $title
* @param string $context
* @return string
*/
function ja_author_box_title( $title, $context ) {
@broros
broros / functions.php
Created Jul 17, 2017 — forked from jaredatch/functions.php
Disable TinyMCE for specific page
View functions.php
<?php
/**
* Disable visual TinyMCE editor for specifc page/post
*
* @since 1.0.0
*/
function ja_disable_fancy_editor( $can ) {
global $post;
if ( 3441 == $post->ID ) {
@broros
broros / functions.php
Created Jul 17, 2017 — forked from jaredatch/functions.php
Remove rogue paragraph from the_content
View functions.php
<?php
/**
* Remove empty paragraph tags
*
* @since 1.0.0
* @param string $content
* @return string
*/
function ja_remove_empty_tags( $content ){
// clean up p tags around block elements
@broros
broros / functions.php
Created Jul 17, 2017 — forked from jaredatch/functions.php
WordPress Search Autocomplete using admin-ajax.php
View functions.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@broros
broros / functions.php
Created Jul 17, 2017 — forked from jaredatch/functions.php
WordPress Search Autocomplete using WP REST API v2
View functions.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@broros
broros / comments.php
Created Jul 17, 2017 — forked from jaredatch/comments.php
WordPress Facebook Comments Lazy Load
View comments.php
<?php
/*
* If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments.
*/
if ( post_password_required() ) {
return;
}
?>
View functions.php
function user_function_restrict_content( $atts, $content = null ) {
if ( is_user_logged_in() && !is_null($content) && !is_feed() ) {
return do_shortcode( $content );
} else {
return 'Sorry, this content is only available for logged users.';
}
}
add_shortcode( 'member', 'user_function_restrict_content' );