Skip to content

Instantly share code, notes, and snippets.

@mjsdiaz
Created January 17, 2015 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjsdiaz/ebbaca0df3ee202bdc84 to your computer and use it in GitHub Desktop.
Save mjsdiaz/ebbaca0df3ee202bdc84 to your computer and use it in GitHub Desktop.
Create Genesis Category and Tag Templates that Look Like iThemes Exchange Store - https://amethystwebsitedesign.com/create-genesis-category-template-like-ithemes-exchange-store
/* iThemes Exchange
---------------------------------------------------- */
/** ---------:[ categories and tags store]:---------- */
.awd-it-exchange-tax-store .entry {
padding: 0;
margin: 0;
}
.awd-it-exchange-tax-store {
background: #fff;
overflow: hidden;
margin-bottom: 40px;
padding: 50px 60px;
}
.awd-it-exchange-tax-store .archive-title {
font-size: 36px;
}
.awd-it-exchange-tax-store .archive-description {
padding: 0;
}
.awd-it-exchange-tax-store .it_exchange_prod {
display: block;
float:left;
width: 45%;
margin: 0 0 5em 0;
vertical-align: top;
}
.awd-it-exchange-tax-store .it_exchange_prod:nth-of-type(2n+1) {
margin-right: 5%;
clear:both;
}
.awd-it-exchange-tax-store .it-exchange-product-details {
padding: 1em;
overflow:hidden;
}
.awd-it-exchange-tax-store .it-exchange-product-title {
font-size: 1.5em;
margin: .5em 0;
padding: 0;
}
.awd-it-exchange-tax-store .it-exchange-product-title a {
text-decoration: none;
}
.awd-it-exchange-tax-store .it-exchange-base-price {
font-size: 1.25em;
float:left;
}
.awd-it-exchange-tax-store .it-exchange-product-permalink {
float:right;
line-height: 2;
}
.awd-it-exchange-tax-store .featured-image-wrapper img {
max-width: 100%;
height: auto;
}
<?php
/*
*
* This is a Geneis child theme archive page for iThemes Exchange to show the
* product categories in a grid, like the store page.
* taxonomy-it_exchange_category.php
*
*/
// Remove default content
remove_action( 'genesis_entry_content', 'genesis_do_post_content', 8 );
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
// Remove entry-header title, markup, and post-info
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title');
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
// Remove post-meta
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
// Add it-exchange-tax-store open div for styling
add_action( 'genesis_before_loop', 'awd_it_exchange_category_store_div', 10 );
function awd_it_exchange_category_store_div() {
echo '<div class="awd-it-exchange-tax-store">';
}
// Add it-exchange-tax-store close div for styling
add_action( 'genesis_after_loop', 'awd_it_exchange_category_store_close_div', 20 );
function awd_it_exchange_category_store_close_div() {
echo '</div> <!-- end .awd-it-exchange-tax-store -->';
}
// Add iThemes Exchange image and details for categories
add_action( 'genesis_entry_content', 'awd_do_category_entry_content', 8 );
function awd_do_category_entry_content() {
if ( ! is_tax( 'it_exchange_category') )
return;
it_exchange_set_product( $post->ID );
if ( it_exchange( 'product', 'has-images' ) ) {
?>
<a class="it-exchange-product-feature-image" href="<?php it_exchange( 'product', 'permalink', array( 'format' => 'url' ) ); ?>">
<?php it_exchange( 'product', 'featured-image', array( 'size' => 'large' ) ); ?>
</a>
<?php } ?>
<div class="it-exchange-product-details">
<h2 class="it-exchange-product-title entry-title">
<a href="<?php it_exchange( 'product', 'permalink', array( 'format' => 'url' ) ); ?>">
<?php it_exchange( 'product', 'title', array( 'format' => 'text' ) ); ?>
</a>
</h2>
<div class="it-exchange-product-price">
<?php it_exchange( 'product', 'base-price' ); ?>
</div>
<a class="it-exchange-product-permalink" href="<?php it_exchange( 'product', 'permalink', array( 'format' => 'url' ) ); ?>">
<?php _e( 'View Details', 'it-l10n-ithemes-exchange' ); ?>
</a>
</div> <!-- end .it-exchange-product-details -->
<?php
}
genesis();
<?php
/*
*
* This is a Geneis child theme archive page for iThemes Exchange
* to show the product tags in a grid, like the store page.
* taxonomy-it_exchange_tag.php
*
*/
// Remove default content
remove_action( 'genesis_entry_content', 'genesis_do_post_content', 8 );
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
// Remove title, markup, and post-info
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title');
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
// Remove post-meta
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
// Add it-exchange-tax-store div for styling
add_action( 'genesis_before_loop', 'awd_it_exchange_tag_store_div', 10 );
function awd_it_exchange_tag_store_div() {
echo '<div class="awd-it-exchange-tax-store">';
}
// Add it-exchange-tax-store close div for styling
add_action( 'genesis_after_loop', 'awd_it_exchange_tag_store_close_div', 20 );
function awd_it_exchange_tag_store_close_div() {
echo '</div> <!-- end .awd-it-exchange-tax-store -->';
}
// Add iThemes Exchange image and details for tags
add_action( 'genesis_entry_content', 'awd_do_tag_entry_content', 8 );
function awd_do_tag_entry_content() {
if ( ! is_tax( 'it_exchange_tag') )
return;
it_exchange_set_product( $post->ID );
if ( it_exchange( 'product', 'has-images' ) ) {
?>
<a class="it-exchange-product-feature-image" href="<?php it_exchange( 'product', 'permalink', array( 'format' => 'url' ) ); ?>">
<?php it_exchange( 'product', 'featured-image', array( 'size' => 'large' ) ); ?>
</a>
<?php } ?>
<div class="it-exchange-product-details">
<h2 class="it-exchange-product-title entry-title">
<a href="<?php it_exchange( 'product', 'permalink', array( 'format' => 'url' ) ); ?>">
<?php it_exchange( 'product', 'title', array( 'format' => 'text' ) ); ?>
</a>
</h2>
<div class="it-exchange-product-price">
<?php it_exchange( 'product', 'base-price' ); ?>
</div>
<a class="it-exchange-product-permalink" href="<?php it_exchange( 'product', 'permalink', array( 'format' => 'url' ) ); ?>">
<?php _e( 'View Details', 'it-l10n-ithemes-exchange' ); ?>
</a>
</div> <!-- end .it-exchange-product-details -->
<?php
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment