Skip to content

Instantly share code, notes, and snippets.

View NicBeltramelli's full-sized avatar
🎯
Focusing

Nic Beltramelli NicBeltramelli

🎯
Focusing
View GitHub Profile
<?php
/**
* Plugin Name: Multisite: Passwort Reset on Local Blog
* Plugin URI: https://gist.github.com/eteubert/293e07a49f56f300ddbb
* Description: By default, WordPress Multisite uses the main blog for passwort resets. This plugin enables users to stay in their blog during the whole reset process.
* Version: 1.0.0
* Author: Eric Teubert
* Author URI: http://ericteubert.de
* License: MIT
*/
<?php
if(!function_exists('wc_get_products')) {
return;
}
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
$ordering = WC()->query->get_catalog_ordering_args();
$ordering['orderby'] = array_shift(explode(' ', $ordering['orderby']));
$ordering['orderby'] = stristr($ordering['orderby'], 'price') ? 'meta_value_num' : $ordering['orderby'];
@NicBeltramelli
NicBeltramelli / encoding-video.md
Created August 19, 2020 09:53 — forked from Vestride/encoding-video.md
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@NicBeltramelli
NicBeltramelli / gutenberg-sample-content.html
Created November 30, 2019 14:35 — forked from mailenkno/gutenberg-sample-content.html
WordPress Gutenberg Sample Content
<!-- wp:paragraph {"align":"center","customTextColor":"#000000","backgroundColor":"very-light-gray","fontSize":"small"} -->
<p style="color:#000000;text-align:center" class="has-background has-small-font-size has-very-light-gray-background-color">Gutenberg Sample Content.<br/>Put together with ❤️ by <a href="https://artisanthemes.io/">Artisan Themes</a>.</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level":1} -->
<h1>This is a heading (H1)</h1>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>This is a heading (H2)</h2>
@NicBeltramelli
NicBeltramelli / gist:13571ee4abdfe6740dc026de351f891f
Created March 7, 2019 12:59 — forked from billerickson/gist:2047229
Improve performance of WP_Query
<?php
$args = array(
// Normal query goes here //
'no_found_rows' => true, // counts posts, remove if pagination required
'update_post_term_cache' => false, // grabs terms, remove if terms required (category, tag...)
'update_post_meta_cache' => false, // grabs post meta, remove if post meta required
);
@NicBeltramelli
NicBeltramelli / function.php
Last active February 26, 2019 23:58
Genesis framework add one more responsive navigation menu.
<?php
// Do NOT include the opening php tag.
/**
* Add tertiary responsive navigation menu.
*
* @author Nic Beltramelli
*/
/* Rename the default navigation menus add the tertiary menu */
@NicBeltramelli
NicBeltramelli / function.php
Created February 18, 2019 14:43
WooCommerce display product category image on category archive
<?php
// Do NOT include the opening php tag.
/**
* Display category image on WooCommerce category archive
*
* @author Nic Beltramelli
*/
add_action(
'woocommerce_archive_description', function () {
@NicBeltramelli
NicBeltramelli / WP_Query.php
Created February 18, 2019 12:11 — forked from Dimasmagadan/WP_Query.php
#WordPress query with args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
//////Author Parameters - Show posts associated with certain author.
@NicBeltramelli
NicBeltramelli / function.php
Created February 14, 2019 20:23
Change the WooCommerce product category image size
<?php
// Do NOT include the opening php tag.
/**
* Change the WooCommerce product category image size
*
* @author Nic Beltramelli
*/
add_filter(
'subcategory_archive_thumbnail_size', function ( $small_thumbnail_size ) {
@NicBeltramelli
NicBeltramelli / function.php
Created February 14, 2019 09:43
Customize the Genesis post meta function for post and WooCommerce product post types
<?php
// Do NOT include the opening php tag.
/**
* Customize the post meta function
*
* @author Nic Beltramelli
*
* @param array $post_meta Default post meta fields.
* @return array Custom post meta fields.