Skip to content

Instantly share code, notes, and snippets.

View mparraud's full-sized avatar
🏠
Working from home

Miguel Parraud Cordeyro mparraud

🏠
Working from home
View GitHub Profile
@nickcernis
nickcernis / genesis-portfolio-pro-modifications.php
Last active October 22, 2019 22:10
Enable the block editor for Genesis Portfolio Pro
<?php
/*
Plugin Name: Genesis Portfolio Pro Modifications
Description: Enable the Block Editor for the Portfolio post type.
Version: 1.0.0
*/
add_filter( 'register_post_type_args', 'studiopress_enable_block_editor_portfolio', 10, 2 );
function studiopress_enable_block_editor_portfolio( $args, $post_type ) {
@wpfangirl
wpfangirl / portfolio-block-template.php
Last active March 28, 2020 19:42
Add Gutenberg suport and a block template to an existing portfolio post type (e.g. from the Portfolio Post Type or Genesis Portfolio Pro plugin)
<?php
/**
* Adds block template to existing post type 'portfolio' with taxonomies 'portfolio_category' and 'portfolio_tag'.
*/
// Add Block Template to existing portfolio post type
function bbp_add_portfolio_template() {
$post_type_object = get_post_type_object( 'portfolio' );
$post_type_object->show_in_rest = true;
$post_type_object->rest_base = 'portfolio';
@woogists
woogists / wc-change-currency-symbol.php
Last active April 18, 2024 08:10
Change a currency symbol
/**
* Change a currency symbol
*/
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'AUD': $currency_symbol = 'AUD$'; break;
}
return $currency_symbol;
@lukecav
lukecav / add-to-cart.php
Last active March 25, 2024 06:59
Display Product Variations in the Shop Loop - With Conditional Apply Filter Logic
<?php
/**
* Custom Loop Add to Cart.
*
* Template with quantity and ajax.
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
global $product;
@dannyconnolly
dannyconnolly / translate_woocommerce.php
Created December 18, 2015 13:22
Change SKU text label in woocommerce to Product Code
function translate_woocommerce($translation, $text, $domain) {
if ($domain == 'woocommerce') {
switch ($text) {
case 'SKU':
$translation = 'Product Code';
break;
case 'SKU:':
$translation = 'Product Code:';
break;
@pradeepdotco
pradeepdotco / functions.php
Last active May 26, 2022 23:41
Add Featured Image Genesis
/* Code to Display Featured Image on top of the post */
add_action( 'genesis_before_entry', 'featured_post_image', 8 );
function featured_post_image() {
if ( ! is_singular( 'post' ) ) return;
the_post_thumbnail('post-image');
}
@idavinder
idavinder / Add multiple Google Fonts to Genesis Theme
Created May 25, 2015 07:42
Add multiple Google Fonts to Genesis Theme
//* Add multiple Google Fonts in Genesis - http://www.basicwp.com/?p=2054
add_action( 'wp_enqueue_scripts', 'genesis_ig_multiple_google_fonts' );
function genesis_ig_multiple_google_fonts() {
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lato|Open+Sans|Oswald:400,300,700', array(), CHILD_THEME_VERSION );
}
@About2git
About2git / functions.php
Last active September 16, 2021 18:54 — forked from srikat/functions.php
Shrinking header in Genesis similar to that in Centric Pro
//* Enqueue Scripts
add_action( 'wp_enqueue_scripts', 'custom_load_scripts' );
function custom_load_scripts() {
wp_enqueue_script( 'shrinking-header', get_bloginfo( 'stylesheet_directory' ) . '/js/shrinking-header.js', array( 'jquery' ), '1.0.0', true );
}
<?php
//* Do NOT include the opening php tag
//* Add multiple grid loops to a page template*/
remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
add_action( 'genesis_loop', 'custom_do_grid_loop' ); // Add custom loop
function custom_do_grid_loop() {
$args = array(
@srikat
srikat / functions.php
Last active April 22, 2021 11:48
Showing a different menu in Primary Navigation location conditionally in Genesis
<?php
//* Do NOT include the opening php tag
add_action( 'genesis_before', 'sk_replace_menu_in_primary' );
/**
* Conditionally replace Custom Menu in Primary Navigation.
*
* @author Sridhar Katakam
* @link http://sridharkatakam.com/conditionally-replace-navigation-menu-genesis/
*/