Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Nic Beltramelli NicBeltramelli

🎯
Focusing
View GitHub Profile
View woocommerce_loop-custom.php
<?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 Aug 19, 2020 — forked from Vestride/encoding-video.md
Encoding video for the web
View encoding-video.md

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
View gutenberg-sample-content.html
<!-- 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>
View gist:13571ee4abdfe6740dc026de351f891f
<?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 Feb 26, 2019
Genesis framework add one more responsive navigation menu.
View function.php
<?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 Feb 18, 2019
WooCommerce display product category image on category archive
View function.php
<?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 Feb 18, 2019 — forked from Dimasmagadan/WP_Query.php
#WordPress query with args
View WP_Query.php
<?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 Feb 14, 2019
Change the WooCommerce product category image size
View function.php
<?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 Feb 14, 2019
Customize the Genesis post meta function for post and WooCommerce product post types
View function.php
<?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.
@NicBeltramelli
NicBeltramelli / function.php
Created Feb 13, 2019
Reposition jetpack sharing buttons below the title on WooCommerce product page
View function.php
<?php
// Do NOT include the opening php tag.
/**
* Reposition sharing buttons below the title on product page
*
* @author Nic Beltramelli
*/
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );