Skip to content

Instantly share code, notes, and snippets.

View nmyers's full-sized avatar

Nicolas nmyers

View GitHub Profile
@nmyers
nmyers / gist:e8ba9dd50bd726c9bf9e
Created February 25, 2015 11:30
Equal height divs
function equalHeight(elem) {
var currentTallest = 0,
currentRowStart = 0,
rowDivs = [],
$el,
topPosition = 0;
$(elem).each(function() {
$el = $(this);
$($el).height('auto');
topPostion = $el.position().top;
@nmyers
nmyers / fluidbricks.js
Last active August 29, 2015 14:18
Fuidbricks - basic masonry alternative
/**
* Requires imagesLoaded
*
*/
(function($) {
$.fluidbricks = function(element, options) {
var defaults = {
'itemClass': '.element',
@nmyers
nmyers / add-open-graph.php
Last active June 23, 2016 11:03
Facebook open graph and Twitter card add in functions.php
function add_opengraph_markup() {
if (is_single()) {
global $post;
if(get_the_post_thumbnail($post->ID, 'thumbnail')) {
$thumbnail_id = get_post_thumbnail_id($post->ID);
$thumbnail_object = get_post($thumbnail_id);
$image = $thumbnail_object->guid;
} else {
// set default image
$image = ''; //
@nmyers
nmyers / Sharer.php
Last active March 24, 2017 17:01
Social share code
<div class="social-share" >
<ul>
<li><h6>SHARE:</h6></li>
<li><a class="twitter" target="_blank" href="https://twitter.com/share?url=<?=rawurlencode(get_permalink())?>&text=<?=rawurlencode(get_the_title().' – ')?>">
<span class="icon-twitter"></span><span class="visuallyhidden" >Twitter</span>
</a></li>
<li><a target="_blank" href="http://www.facebook.com/sharer.php?u=<?=rawurlencode(get_permalink())?>" >
<span class="icon-facebook"></span><span class="visuallyhidden" >Facebook</span>
</a></li>
<li><a target="_blank" href="/cdn-cgi/l/email-protection#650008040c09405755040101170016164057550d0017005a1610070f00061158595a58170412101709000b060a01004d42260d00060e45110d0c16450a10115f452b0009091c4527000b452d041c0a100b45361110010c0a4587e5f645424b0200113a110d003a110c1109004d4c4c5a5b43070a011c58595a58170412101709000b060a01004d0200113a1500170804090c0b0e4d4c4c5a5b">
@nmyers
nmyers / gist-get-files.sh
Created June 23, 2017 11:10
Get files only from gist
git clone --depth 1 https://gist.github.com/d5d78fc32e458d309eab4fb89a258f1b.git social-share; cd social-share ; rm -rf .git
@nmyers
nmyers / _wpb_menu-icons.md
Last active March 6, 2018 11:09
Wordpress menu with icons #wp

Menu icons block

@nmyers
nmyers / inc-social-share.php
Last active March 6, 2018 11:09
Social Share #wp
<?php
function add_opengraph_markup() {
if (is_single()) {
global $post;
$twitter_handle = '';
$image = get_image(get_field('main_image'),'692x410');
$description = substr(strip_tags($post->post_content),0,200) . '...';
?>
<meta property="og:title" content="<?php the_title(); ?>" />
@nmyers
nmyers / functions.php
Created March 6, 2018 11:11
Custom tinymce editor wordpress #wp
function custom_tiny_mce( $settings ) {
$settings['toolbar1'] = 'styleselect,bold,italic,bullist,blockquote,hr,alignleft,aligncenter,link,unlink';
$style_formats = array(
array(
'title' => 'Content Block',
'block' => 'span',
'classes' => 'content-block',
'wrapper' => true,
),
array(
@nmyers
nmyers / .htaccess
Created April 6, 2018 08:34
redirect images to another server .htaccess #htaccess #wordpress
# local settings
RewriteEngine On
RewriteRule ^(wp-content/uploads/.*) https://lansons.com/$1 [L]
@nmyers
nmyers / functions.php
Last active May 27, 2018 04:22
Submenu nav - wordpress #wp
// add hook
add_filter( 'wp_nav_menu_objects', 'my_wp_nav_menu_objects_sub_menu', 10, 2 );
// filter_hook function to react on sub_menu flag
function my_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) {
// global $wp_query;
// console_debug('post is single >>',is_single() ? 'yes' : 'no');
//console_debug('menu',$sorted_menu_items);
if (is_single()) {