Skip to content

Instantly share code, notes, and snippets.

@hugosolar
hugosolar / release.sh
Last active March 31, 2020 22:08
This is a bash script to release new version of the current wp-theme-cc-chapter theme with all the needed dependencies
#!/bin/bash
#
# This script generates a release zip file from the WordPress theme of the CC Chapter websites
# useful for standaolone installs
set -o errexit
set -o errtrace
set -o nounset
trap '_es=${?};
@hugosolar
hugosolar / ccgn-workflow.mermaid
Last active January 29, 2020 12:31
Mermaid syntax CCGN workflow
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hugosolar
hugosolar / functions.php
Created November 30, 2018 01:50
Use category image instead custom placeholder on Woocommerce
/**
* Change the placeholder image
*/
add_filter('woocommerce_placeholder_img_src', 'custom_woocommerce_placeholder_img_src');
function custom_woocommerce_placeholder_img_src($src)
{
global $post;
$terms = wp_get_post_terms($post->ID, 'product_cat');
$thumbnail_id = get_woocommerce_term_meta($terms[0]->term_id, 'thumbnail_id', true);

Keybase proof

I hereby claim:

  • I am hugosolar on github.
  • I am hsolar (https://keybase.io/hsolar) on keybase.
  • I have a public key ASAt1Z0R_QV4ntyIrlfqgkVougp_9l6S2otDvPz3P3lRLgo

To claim this, I am signing this object:

<?php
// Social Feed para sitios en wordpress
class SocialFeed {
private static $instance;
public $feed_list;
public $yt_status;
public $fb_status;
@hugosolar
hugosolar / fsqm-pro-punga-exporter.php
Created October 23, 2015 18:09
Simple simple exporter to fsqm-pro plugin
<?php
error_reporting(0);
//FORM ID
$id_form = 8;
//manual translate of smileyrate
function smilley_translate($smile) {
switch ($smile) {
case 'frown': return 'molesto'; break;
case 'sad': return 'Muy insatisfecho(a)'; break;
@hugosolar
hugosolar / custom-button-parallax.js
Last active August 27, 2015 20:57
Add buttons to tinyMCE on Wordpress
(function(){
/*
Este boton deja entre shortcodes el texto seleccionado
para dar el formato requerido por el layout
*/
tinymce.PluginManager.add('custom_button_parallax_content', function( editor, url ) {
editor.addButton( 'custom_button_parallax_content', {
text: '',
icon: 'icn icn-imagen',
title: 'Contenido Parallax',
@hugosolar
hugosolar / videos.php
Last active August 29, 2015 14:06
Class Videos
<?php
class videos {
/* function get_video
* Extract and return video id from youtbe & vimeo videos
* @param url : Video url
*/
static function get_video($url,$width=560,$height=315) {
if (strstr($url,'youtube')){
$parse_url=parse_url($url);
parse_str($parse_url['query']);
@hugosolar
hugosolar / Estructura
Last active August 18, 2022 17:25
Gruntfile for Ember JS app
* significa que lo genera Grunt
------------------------------------
.
|-- Gruntfile.js ( el de arriba)
|-- css
| |-- style.css (development *)
| `-- style.min.css ( production * )
|-- font -> ../../framework/font
|-- img -> ../../framework/img
|-- index.html
@hugosolar
hugosolar / menu_images.js
Last active November 21, 2017 18:34
Javascript class to use new wp.media uploader to upload or use an existing image to use it in the wordpress custom menu using this plugin idea https://github.com/blazersix/simple-image-widget
jQuery(function($) {
var $control;
mediaControl = {
// Initializes a new media manager or returns an existing frame.
// @see wp.media.featuredImage.frame()
frame: function() {
if ( this._frame )
return this._frame;
this._frame = wp.media({