Skip to content

Instantly share code, notes, and snippets.

@jprieton
jprieton / google-url-shortener.php
Last active August 29, 2015 14:04
Google URL Shortener
<?php
function short_url($longUrl) {
$apiKey = 'MyAPIKey';
$postData = array('longUrl' => $longUrl, 'key' => $apiKey);
$jsonData = json_encode($postData);
$curlObj = curl_init();
@jprieton
jprieton / custom-timeline.js
Created August 5, 2014 16:25
Inyectar CSS al widget de Twitter para personalizar
$(window).load(function() {
var head = $("iframe.twitter-timeline").contents().find("head");
head.append($("<link/>", {rel: "stylesheet", href: "path/absolute/to/css", type: "text/css"}));
});
@jprieton
jprieton / timthumb_webconfig.xml
Last active August 29, 2015 14:05
timthumb_webconfig
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<rewrite>
<rules>
<rule name="TimThumb" stopProcessing="true">
<match url="\.(jpg|jpeg|gif|png)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="false" />
@jprieton
jprieton / text-align
Created October 23, 2014 15:58
Bootstrap Responsive Text Align
@media (max-width: 767px) {
.text-left-xs {
text-align: left;
}
.text-center-xs {
text-align: center;
}
.text-right-xs {
text-align: right;
}
@jprieton
jprieton / wp-desc-metabox.php
Created October 23, 2014 20:16
WordPress description metabox
<?php
// Colocar en el functions.php
function metabox_callback()
{
?>
<p>Aquí va el contenido...</p>
<?php
}
@jprieton
jprieton / custom-post-type-archive-menu-links.php
Last active August 29, 2015 14:13 — forked from davidmh/custom-post-type-archive-menu-links.php
Adds Custom Post Type archives to the WordPress-powered menus. Compatible with WP 4
<?php
/*
Plugin Name: Custom Post Type Archive Menu Links
Plugin URI: http://codeseekah.com/2012/03/01/custom-post-type-archives-in-wordpress-menus-2/
Description: Easily Add Custom Post Type Archives to the Nav Menus
Version: 1.2
Author: soulseekah
Author URI: http://codeseekah.com
License: GPL2
@jprieton
jprieton / gallery-meta-box
Last active August 29, 2015 14:16
Gallery Meta Box
@jprieton
jprieton / form.php
Last active August 29, 2015 14:17
Formulario de registro WordPress / JP Theme Tools
<form id="registerform" method="post" action="<?php home_url() ?>" name="loginform">
<div class="form-group">
<label for="user_login">Email</label>
<input type="text" class="form-control" name="user_login" id="user_login" placeholder="Tu email">
</div>
<div class="form-group">
<label for="user_password">Contraseña</label>
<input type="password" class="form-control" id="user_password" name="user_password" placeholder="Contraseña">
</div>
<div class="form-group">
(function ($) {
$.fn.ajaxFormSubmit = function (options) {
var settings = $.extend({
alertContainer: '',
callback: null
}, options);
if (typeof admin_url === 'undefined')
return this;
var fields = $(this).find('input, select, textarea').not(':disabled');
@jprieton
jprieton / gist:8ed84b4e74cc785a6703
Last active August 29, 2015 14:18
Validation engine + bootstrap
$(function () {
jQuery('#formID').validationEngine('attach', {
showPrompts: false,
showArrow: false
}).bind("jqv.field.result", function (event, field, errorFound, prompText) {
var formGroup = field.parents(".form-group");
formGroup.removeClass("has-feedback has-error has-success");
if (errorFound) {
formGroup.addClass("has-feedback has-error");
jQuery(formGroup).find("span.help-block, span.form-control-feedback").remove();