Skip to content

Instantly share code, notes, and snippets.

View palimadra's full-sized avatar

Pali Madra palimadra

View GitHub Profile
@palimadra
palimadra / wp-filter-error.php
Created August 21, 2015 09:15
How to create a filter to show a custom error on login
add_filter('login_errors','login_error_message');
function login_error_message( $error ){
$error = "Incorrect login information, stay out!";
return $error;
}
@palimadra
palimadra / wp-enqueue-font.php
Created August 21, 2015 09:14
How to enqueue a font properly in WordPress (specially from Google Fonts)
add_action( 'wp_enqueue_scripts', 'my_enqueued_assets' );
function my_enqueued_assets() {
wp_enqueue_style( 'my-font', '//fonts.googleapis.com/css?family=Roboto' );
}
@palimadra
palimadra / wp-enqueue.php
Created August 21, 2015 09:12
How to properly enqueue stuff in WordPress
add_action( 'wp_enqueue_scripts', 'my_enqueued_assets' );
function my_enqueued_assets() {
wp_enqueue_script( 'my-script', plugin_dir_url( __FILE__ ) . '/js/my-script.js', array( 'jquery' ), '1.0', true );
}
@palimadra
palimadra / wppluginskeleton.php
Created August 21, 2015 09:11
A skeleton for WordPress plugin. This content should be there in the main PHP file of the WordPress plugin
<?php
/**
* Plugin Name: My Facebook Tags
* Plugin URI: http://palimadra.com
* Description: This plugin adds some Facebook Open Graph tags to our single posts.
* Version: 1.0.0
* Author: palimadra
* Author URI: http://palimadra.tumblr.com
* License: GPL2
*/

/* If you migrated from Sublime Text 2 to Sublime Text 3 the tab no longer works for expanding abbreviations using the Emmet package. To fix it add this to Key Bindings - User and get the tab working as the keyboard shortcut for expanding emmet abbreviations. */

{

"keys": [

"tab"

@palimadra
palimadra / gist:6e9b988de3bb0ee2d625
Created July 13, 2015 11:23
Code snippet for squarespace
/* to adjust space betweent the featured image and snippet in blog post paste the code and experiment with the px setting */
/* close up space between blog entry image and excerpt text */
#page article[class^="promoted-block-"] .special-content {
margin-bottom: 25px; /* template default = 45px */
}
// How to add a bookmarklet to Chrome: https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=chrome%20bookmarklet
javascript:(function getScreenshot() {var openScreenshot = function(e) {window.open(e.originalEvent.data);}; $(window).unbind("message.getScreenshot", openScreenshot); $(window).bind("message.getScreenshot", openScreenshot); ScratchpadUI.liveEditor.postFrame({ screenshot: true, screenshotSize: 400 });})();
@palimadra
palimadra / currency-pciker-shopify.html
Last active January 30, 2017 10:23 — forked from carolineschnapp/gist:773649
Currency picker snippet that needs to be added to the shopify theme in the snippets folder to be used in conjunction with currencies.liquid at https://gist.github.com/palimadra/98127337d73270923925
<label class="currency-picker__wrapper">
<span class="currency-picker__label">Pick a currency</span>
<select class="currency-picker" name="currencies" style="display: inline; width: auto; vertical-align: inherit;">
{% assign codes = 'USD,EUR,GBP,CAD,ARS,AUD,BBD,BDT,BSD,BHD,BRL,BOB,BND,BGN,ILS,MMK,KYD,CLP,CNY,COP,CRC,HRK,CZK,DKK,DOP,XCD,EGP,XPF,FJD,GHS,GTQ,GYD,GEL,HKD,HUF,ISK,INR,IDR,NIS,JMD,JPY,JOD,KZT,KES,KWD,LVL,LTL,MXN,MYR,MUR,MDL,MAD,MNT,MZN,ANG,NZD,NGN,NOK,OMR,PKR,PYG,PEN,PHP,PLN,QAR,RON,RUB,SAR,RSD,SCR,SGD,SYP,ZAR,KRW,LKR,SEK,CHF,TWD,THB,TZS,TTD,TRY,UAH,AED,UYU,VEB,VND,ZMK' | split: ',' %}
{% assign supported_codes = settings.supported_currencies | split: ' ' %}
<option value="{{ shop.currency }}" selected="selected">{{ shop.currency }}</option>
{% for code in supported_codes %}
{% if code != shop.currency and codes contains code %}
<option value="{{ code }}">{{ code }}</option>
{% endif %}
@palimadra
palimadra / currencies.liquid
Last active August 29, 2015 14:23 — forked from carolineschnapp/currencies.liquid
Code that needs to be added as a new snippet in the shopify theme to be used in conjunction with currency picker at https://gist.github.com/palimadra/842e597a01552a4d0c8f
{% if settings.show_multiple_currencies %}
{{ "//cdn.shopify.com/s/javascripts/currencies.js" | script_tag }}
{{ "jquery.currencies.min.js" | asset_url | script_tag }}
<script>
Currency.format = '{{ settings.currency_format | default: 'money_with_currency_format' }}';
var shopCurrency = '{{ shop.currency }}';
@palimadra
palimadra / Dynamic text effect for Cryca.markdown
Created June 16, 2015 09:37
Dynamic text effect for Cryca

Dynamic text effect for Cryca

A variation of the dynamic text effect created for the website at cryca.com

A Pen by Pali Madra on CodePen.

License.