This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag shown above. Copy the code shown below. | |
//* Remove default sidebar, add shop sidebar | |
add_action( 'genesis_before', 'wpstudio_add_woo_sidebar', 20 ); | |
function wpstudio_add_woo_sidebar() { | |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { | |
if( is_woocommerce() ) { | |
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag shown above. Copy the code shown below. | |
//* Register webshop sidebar | |
genesis_register_sidebar( array( | |
'id' => 'woo_primary_sidebar', | |
'name' => __( 'Webshop Sidebar', 'themename' ), | |
'description' => __( 'This is the WooCommerce webshop sidebar', 'themename' ), | |
) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag shown above. Copy the code shown below. | |
//* Add description to menu items | |
add_filter( 'walker_nav_menu_start_el', 'wpstudio_add_description', 10, 2 ); | |
function wpstudio_add_description( $item_output, $item ) { | |
$description = $item->post_content; | |
if (' ' !== $description ) { | |
return preg_replace( '/(<a.*)</', '$1' . '<span class="menu-description">' . $description . '</span><', $item_output) ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<i class="fa fa-tree"></i> | |
<h4>Nature</h4> | |
Nam pretium turpis et arcu. Pellentesque auctor neque nec urna. Sed consequat, leo eget bibendum.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.soldout { | |
background: #c7ad7b; | |
color: #fff; | |
font-size: 14px; | |
font-weight: 700; | |
padding: 6px 12px; | |
position: absolute; | |
right: 0; | |
top: 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag | |
//* Add sold out badge on single product pages | |
add_action( 'woocommerce_before_single_product_summary', function() { | |
global $product; | |
if ( !$product->is_in_stock() ) { | |
echo '<span class="soldout">Sold out</span>'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag | |
//* Add sold out badge on archive pages | |
add_action( 'woocommerce_before_shop_loop_item_title', function() { | |
global $product; | |
if ( !$product->is_in_stock() ) { | |
echo '<span class="soldout">Sold out</span>'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_action( 'genesis_site_description', 'genesis_seo_site_description' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening PHP tag | |
//* Remove site description on all pages except homepage | |
add_action('get_header', 'wpstudio_remove_header'); | |
function wpstudio_remove_header() { | |
if ( !is_front_page() ) { | |
remove_action( 'genesis_site_description', 'genesis_seo_site_description' ); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening PHP tag | |
//* H1 site title only on the frontpage | |
add_filter('genesis_seo_title', 'wpstudio_site_title' ); | |
function wpstudio_site_title( $title ) { | |
$custom_title = get_bloginfo( 'name' ); | |
$tag = ( is_home() || is_front_page() ) ? 'h1' : 'p'; | |
$inside = sprintf( '<a href="%s" title="%s">%s</a>', trailingslashit( home_url() ), esc_attr( get_bloginfo( 'name' ) ), $custom_title ); | |
$title = sprintf ( '<%s class="site-title" itemprop="headline">%s</%s>', $tag, $inside, $tag ); |