User Tools

Site Tools


ecommerce:storefront_child_theme_functions.php
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


ecommerce:storefront_child_theme_functions.php [2021/10/20 23:28] (current) – created mithat
Line 1: Line 1:
 +====== functions.php for Storefront child theme ======
 +Hack to get the copyright line to appear as I want.
  
 +<file php functions.php>
 +<?php
 +// Exit if accessed directly
 +if ( !defined( 'ABSPATH' ) ) exit;
 +
 +// BEGIN ENQUEUE PARENT ACTION
 +// AUTO GENERATED - Do not modify or remove comment markers above or below:
 +
 +// END ENQUEUE PARENT ACTION
 +
 +/*
 + * MFK Storefront customizations
 + * Mithat Konar
 + */
 +
 +/* Replace copyright info. */
 +//storefront_credit is a "pluggable" function
 +function storefront_credit() {
 +    ?>
 +        <div class="site-info">
 +            Copyright &copy 2018-2021 Mithat Konar. All rights reserved.       
 +        </div>
 +    <?php
 +}
 +
 +/* Disable different address checked by default.
 + * From https://metorik.com/blog/change-woocommerce-ship-to-a-different-address-default
 + * Doesn't work with zones very well.
 + */
 +//add_filter( 'woocommerce_ship_to_different_address_checked', '__return_false' );
 +
 +/* Number of categories on homepage. */
 +add_filter('storefront_product_categories_shortcode_args','custom_storefront_category_per_page' );
 +function custom_storefront_category_per_page( $args ) {
 + $args['number'] = 2;
 + $args['columns'] = 2;
 + return $args;
 +}
 +
 +/* Change titles of homepage sections */
 +// Featured products
 +add_filter( 'storefront_featured_products_args', 'custom_storefront_product_featured_title');
 +function custom_storefront_product_featured_title( $args ) {
 +    $args['title'] = __( 'Featured products', 'storefront' );
 +    return $args;  
 +}
 +
 +// Recent (new) products title
 +add_filter( 'storefront_recent_products_args', 'custom_storefront_product_recent_products_title');
 +function custom_storefront_product_recent_products_title( $args ) {
 +    $args['title'] = __( 'New products', 'storefront' );
 +    return $args;  
 +}
 +
 +/* Fonts */
 +// From http://www.fix-css.com/2016/09/remove-google-fonts-form-woo-storefront-theme/
 +// Remove Google Font from Storefront theme
 +/*
 +function iggy_child_styles() {
 +    wp_dequeue_style('storefront-fonts');
 +    add_filter( 'storefront_google_font_families', 'my_font_families' ); // mfk to add desired fonts back in
 +    wp_enqueue_style('storefront-fonts');                                // mfk to add desired fonts back in
 +}
 +add_action( 'wp_enqueue_scripts', 'iggy_child_styles', 900);
 +*/
 +
 +// If you just need to change Google font from default one, you may use the snippet taken from here.
 +/*
 +add_filter( 'storefront_google_font_families', 'my_font_families' );
 +function my_font_families( $family ) {
 +    //$family = [];    // mfk to get rid of Source Sans Pro, which isn't gotten rid of anyway though it's not in HTML 
 +    $family['merienda'] = 'Merienda:400,700';
 +    return $family;
 +}
 +*/
 +</file>
ecommerce/storefront_child_theme_functions.php.txt · Last modified: 2021/10/20 23:28 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki