Skip to content

Instantly share code, notes, and snippets.

View aristath's full-sized avatar
🏠

Ari Stathopoulos aristath

🏠
View GitHub Profile
@aristath
aristath / phpcs.bash
Last active September 19, 2019 08:20 — forked from ilicfilip/tf-checkout.bash
Runs PHPCS on changed files only
if [ $# -lt 0 ]; then
echo "------------------------"
echo "usage: $0 \$1"
echo " \$1: Files to check"
echo "------------------------"
exit 1
fi
if [ "$#" == 1 ]
then
@aristath
aristath / simplify-gutengerg.js
Created March 23, 2018 12:45 — forked from dennyf/simplify-gutengerg.js
This is an example of how we can simplify Gutenberg's custom block API - this is only an illustrative example
const { __ } = wp.i18n; // Import __() from wp.i18n
const { registerBlockType, RichText, UrlInput, InspectorControls, PanelColor, ColorPalette } = wp.blocks;
/**
* This class registers a custom block type, by creating the
* controls and updating the values automatically. It also allows passing a single
* render function to avoid repetitive code in edit and update.
*/
class MyCustomComponent{
<?php
/**
* Plugin Name: Demo Plugin for #26061
* Description: Registers a new setting for a non-scalar value (i.e. an assoc array) and a control which allows the setting to be updated by pressing a button.
* Author: Weston Ruter, X-Team
* Author URI: http://x-team.com/profile/weston-ruter/
*/
function wp26061_customize_register( $wp_customize ) {
<?php
/**
* Handles the init and hooks to the customize_register action
*
* @author Enrico Ripalti
*
* @param WP_Customize_Manager $wp_customize: The WP_Customize_Manager instance
* @hooked customize_register
*/
function commlyCustomizerInit( $wp_customize ) {
<?php
/*
Template Name: kalu
*/
?>
<?php get_header(); ?>
<section id="content" role="main">
<?php the_content(); ?>
</section>
<?php
global $post, $wp_query, $query_string, $Directory_Core;
$dr = $Directory_Core;
/* Display navigation to next/previous pages when applicable */
echo $dr->pagination( $dr->pagination_top );
<?php
/**
* The loop that displays posts.
* You can override this file in your active theme.
*
* The loop displays the posts and the post content. See
* http://codex.wordpress.org/The_Loop to understand it and
* http://codex.wordpress.org/Template_Tags to understand
* the tags used in it.
*
<?php get_header(); ?>
<?php
// Check and get Sidebar Class
$sidebar = get_post_meta($post->ID,'post-option-sidebar-template',true);
global $default_post_sidebar;
if( empty( $sidebar ) ){ $sidebar = $default_post_sidebar; }
if( $sidebar == "left-sidebar" || $sidebar == "right-sidebar"){
$sidebar_class = "sidebar-included " . $sidebar;
}else if( $sidebar == "both-sidebar" ){
$sidebar_class = "both-sidebar-included";
<?php
/*
* The page core options for the Shoestrap theme
*/
if ( !function_exists( 'shoestrap_module_coulourlovers_options' ) ) :
function shoestrap_module_coulourlovers_options( $sections ) {
// Page Options