Skip to content

Instantly share code, notes, and snippets.

View mrfoxtalbot's full-sized avatar
🕊️

Alvaro Gómez Velasco mrfoxtalbot

🕊️
View GitHub Profile
@font-face {
font-family: 'Your Custom Font';
src: url('fonts/webfont.eot'); /* IE9 Compat Modes */
src: url('fonts/webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('fonts/webfont.woff') format('woff'), /* Modern Browsers */
url('fonts/webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('fonts/webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
@lmartins
lmartins / functions.php
Last active November 3, 2023 19:28 — forked from woogist/functions.php
By default WooCommerce redirects the user to the My Account page after a successful login. You may change this and use a custom URL based on the user role, like the Dashboard for admins and My Account page for customers. To do this, add this code at the end of the file functions.php located in wp-content/themes/your-theme-name/ https://support.w…
<?php
/**
* Redirect users to custom URL based on their role after login
*
* @param string $redirect
* @param object $user
* @return string
*/
function wc_custom_user_redirect( $redirect, $user ) {
// Get the first of all the roles assigned to the user
// Load translation files from your child theme instead of the parent theme
function my_child_theme_locale() {
load_child_theme_textdomain( 'total', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'my_child_theme_locale' );
@woogist
woogist / functions.php
Created January 29, 2015 13:17
Set a custom add to cart URL to redirect to
/**
* Set a custom add to cart URL to redirect to
* @return string
*/
function custom_add_to_cart_redirect() {
return 'http://www.yourdomain.com/your-page/';
}
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect' );
@bekarice
bekarice / wc-add-images-order-email-table.php
Created May 26, 2015 21:08
Add images to WooCommerce emails
// Edit order items table template defaults
function sww_add_wc_order_email_images( $table, $order ) {
ob_start();
$template = $plain_text ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
wc_get_template( $template, array(
'order' => $order,
'items' => $order->get_items(),
'show_download_links' => $show_download_links,
@jasperf
jasperf / header.php
Last active July 23, 2017 12:16 — forked from retlehs/header.php
Header.php for Roots Sage theme to work with the Bootstrap Menu again using the wp-bootstrap-navwalker #wordpress #roots #sage
<?php
// This file assumes that you have included the nav walker from https://github.com/twittem/wp-bootstrap-navwalker
// somewhere in your theme.
?>
<header class="banner navbar navbar-default navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span>
anonymous
anonymous / RPJGBr.markdown
Created July 13, 2015 21:56
RPJGBr
@igmoweb
igmoweb / site-new.php
Last active November 19, 2015 13:54
Custom query shortcode
<?php
add_shortcode( 'areas', 'custom_query_shortcode' );
function custom_query_shortcode( $atts ) {
// EXAMPLE USAGE:
// [areas show_posts="100" post_type="page" post_parent="246"]
// Defaults
$defaults = array(
"show_posts" => 100,
"post_type" => 'page',
@m
m / gist:bab8d366d2e826ba2311
Last active December 4, 2019 00:53
freedom zero mark pilgrim text
Movable Type has never been Free Software, as defined by the Free Software
Foundation. It has never been open source software, as defined by the Open
Source Initiative. Six Apart survived and thrived in the blogging community
because Movable Type was “free enough.”
Many people misunderstand
Free Software and the GNU General Public License. Many people equate the GPL to
the boogeyman, because it’s “viral”, and that sounds like a bad thing.
anonymous
anonymous / functions.php
Created January 25, 2016 15:56
WordPress shortcode to display a category description?
Try this. Add the code below to your functions.php file -
add_shortcode('cat_description', 'my_cat_description_shortcode');
function my_cat_description_shortcode($atts){
$a = shortcode_atts( array(
'id' => 0,
), $atts );
return category_description($a['id']);