Skip to content

Instantly share code, notes, and snippets.

@jquimera
jquimera / ajax-action.php
Created January 26, 2018 16:11 — forked from danielpataki/ajax-action.php
Ajax in WordPress
add_action( 'wp_ajax_button_click', 'user_clicked' );
function user_clicked() {
update_user_meta( get_current_user_id(), 'clicked_link', 'yes' );
wp_redirect( $_SERVER['HTTP_REFERER'] );
exit();
}
@jquimera
jquimera / README.md
Created March 12, 2018 23:40 — forked from barneycarroll/README.md
Lock and unlock a page's scroll position.

jquery.scrollLock.js

Useful for when a blocking user experience is needed (in my case, didn't want people unwittingly loosing their place by scrolling while a modal required their attention): $.scrollLock() locks the body in place, preventing scroll until it is unlocked.

// Locks the page if it's currently unlocked
$.scrollLock();

// ...or vice versa
/*
Cross-browser (including IE8-10)
Más info: http://coding.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css/
*/
.absolute-center {
/* height: must be declared */
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}
/*
* http://christian-fei.com/tutorials/how-to-lazy-load-disqus-comments/
*
* <div class="comments"></div>
*/
var comments = document.getElementsByClassName('comments')[0],
disqusLoaded = false;
function loadDisqus() {
@jquimera
jquimera / taxonomy-links.php
Created May 9, 2018 14:02 — forked from jazzsequence/taxonomy-links.php
Get taxonomy links in WordPress for a custom post type and custom taxonomy, similar to get_the_category_list() or get_the_term_list() but is a bit smarter about separators.
@jquimera
jquimera / functions.php
Created June 1, 2018 16:13 — forked from scottparry/functions.php
Enqueue Google fonts in WordPress theme
/**
* Enqueue custom fonts using protocol relative URL.
*
* Syntax: wp_enqueue_style( $handle, $src, $deps, $ver, $media );
* Ensure $handle is unique to prevent conflicts with plugins
*
* Note(s): The pipe (|) operator is used to load multiple typefaces in a single call. We also only load the weights we want * by comma seperating them, instead of loading every available weight.
*/
function theme_prefix_fonts()
{
@jquimera
jquimera / CustomWidgetFile.php
Created June 13, 2018 19:13 — forked from jonathonbyrdziak/CustomWidgetFile.php
EMPTY WIDGET Plugin code to create a single widget in wordpress.
<?php
/**
* Duplicate this file as many times as you would like, just be sure to change the
* Empty_Widget class name to a custom name of your choice. Have fun! redrokk.com
*
* Plugin Name: Empty Widget
* Description: Single Widget Class handles all of the widget responsibility, all that you need to do is create the html. Just use Find/Replace on the Contact_RedRokk_Widget keyword to rebrand this class for your needs.
* Author: RedRokk Interactive Media
* Version: 1.0.0
* Author URI: http://www.redrokk.com
@jquimera
jquimera / plugin.php
Created August 30, 2018 00:42 — forked from igorbenic/plugin.php
Show a WordPress Post in a Modal - Article on Ibenic.com
<?php
/**
* Plugin Name: IBenic Bootstrap Modal
* Plugin URI: http://www.ibenic.com/show-a-wordpress-post-in-a-modal/
* Description: Show an article in a modal on the same page.
* Version: 1.0
* Author: Igor benić
* Author URI: http://www.ibenic.com
* License: GPL2
*
@jquimera
jquimera / cygwin_tutorial.md
Created December 4, 2018 13:15 — forked from AllanNozomu/cygwin_tutorial.md
Instalando e Utilizando o Cygwin no Windows

Instalando e Utilizando o Cygwin no Windows

1. Requisitos mínimos

  • A instalação Cygwin é recomendada para quem utiliza versões anteriores do Windows 10. Caso utilize Windows 10, sugere-se a instalação do Bash - http://www.ic.unicamp.br/~mc102/tutorial-bash.html.
  • É necessário aproximadamente 150MB de memória disponível

2. Introdução

Cygwin é um emulador de terminal com uma grande coleção de ferramentas GNU e Open Source, que disponibilizam funcionalidades similares às disponíveis em distribuições Linux no ambiente Windows.

@jquimera
jquimera / tools.md
Created December 4, 2018 14:38 — forked from paulocheque/tools.md
Essential Dev Tools

Basic

  • Sublime 3
    • Package Control
    • Markdown highlight
    • INI highlight
    • Nginx highlight
    • Play highlight
    • Python improved
  • Generic Config highlight