The Shop

The advanced Woocommerce features in GeneratePress Premium 1.8 has allowed my to divulge in some new custom functions and styling. Upon visiting the Shop page you will see several custom elements and styles.

  • Category Navigation below entry title
  • Off Canvas Filter Toggle
  • Repositioned Breadcrumb
  • Minimal styled shop grid with hover add to cart effect

Hook Elements

Niche uses two GeneratePress Hook Elements. You can read the documents for hooks here. The shop uses two hook Elements.

  • Woocommerce Shop Category Menu
  • Woo Shop Filter and Breadcrumb

Both of these elements display rules are set to our Product Archive ( The Shop ) and Product Category Archives.

Hook #1 – Woocommerce Shop Category Menu

To aid with navigation across categories our first hook adds a simple category menu to the woocommerce_archive_description.

<?php
$orderby = 'name';
$order = 'asc';
$hide_empty = true ;
$cat_args = array(
    'orderby'    => $orderby,
    'order'      => $order,
    'hide_empty' => $hide_empty,
);
 
$product_categories = get_terms( 'product_cat', $cat_args );
 
if( !empty($product_categories) ){
    echo '
 
<ul class="woo-cat-nav">';
    foreach ($product_categories as $key => $category) {
        echo '
 
<li>';
        echo '<a href="'.get_term_link($category).'" >';
        echo $category->name;
        echo '</a>';
        echo '</li>';
    }
    echo '</ul>
 
';
}
?>

It simply outputs a list of all categories that contain a product. We then use some CSS to style the list:

.woo-cat-nav {
    list-style-type: none;
    margin-left: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 80px;
}

.woo-cat-nav li {
    padding: 5px 0;
    margin: 0 10px;
    border-bottom: 1px solid #ccc;
    font-size: 0.95em;
}

As each of the list items are a link they get their colors from the link colors we set in the customizer. Apart from the border color which is within the CSS above.

Hook #2 – Woo Shop Filter and Breadcrumb

Then we add two functions to woocommerce_before_shop_loop hook. First is a custom Off Canvas Panel toggle and second is the Woocommerce Breadcrumb.

Woo Shop Filter

The first function in our hook is some simple HTML:

<span class="slideout-toggle woo-filter-toggle hide-on-mobile"><a href="#">FILTER</a></span>

The <span> tag contains three classes. The slideout-toggle is what GeneratePress requires to trigger the opening of the off canvas panel. The woo-filter-toggle is our own custom class we use to style and position the toggle. And lastly hide-on-mobile, i am sure you can figure out what this does.

For our woo filter toggle to appear we have set Customizer > Layout > Off Canvas Panel to display on Desktop and Mobile.

We now need to remove the toggle from the Primary Navigation on Desktop ( it’s default location ) we have to hide it using some CSS:

.main-navigation ul li.slideout-toggle {
    display: none !important;
}

Breadcrumb

Here is our second function to add our breadcrumb inline with our filter toggle:

<span class="hide-on-mobile"><?php woocommerce_breadcrumb(); ?></span>

It uses the default woocommerce function. So as it doesn’t display twice on the page we disabled the themes breadcrumb position in Customizer > Layout > Woocommerce.

Positioning and styling the filter and breadcrumb

Positioning and styling our toggle and breadcrumb requires this CSS:

.woo-filter-toggle,
.woocommerce.archive .woocommerce-breadcrumb {
    padding: 10px 0;
    margin-right: 20px;
    float: left;
    font-size: 14px;
    line-height: 20px;
}

To make room for our filter toggle and breacrumb and to keep the styles in line we need a little more CSS. First to shift over the product count and then style the sorting selector.

.woocommerce .woocommerce-result-count {
    float: right;
    margin-right: 20px;
}

.woocommerce-ordering select {
    text-transform: uppercase;
    max-width: 200px;
    border: 0;
}

Custom Post Grid

Most of our shop styling has been set using the Theme customizer, from typograpghy and colors to the layout of our shop and single product page. But to add a little something more unique the obligatory Flint Skin CSS magic has bee applied.

Custom CSS

Lets step through each of the changes:

Reduced grid Gap

No GeneratePress uses CSS Grid for the shop its super simple to reduce ( or increase ) our grid gap. This is being applied to all responsive sizes.

.wc-columns-container .products,
.woocommerce .related ul.products,
.woocommerce .up-sells ul.products {
    grid-gap: 20px;
}

Remove Add to Cart button styling

I wanted a normal looking link for our add to cart by removing the padding and background color. and inheriting the body text color.

.woocommerce ul.products li.product a.button {
    padding: 5px 0;
    color: inherit;
    background-color: transparent;
}

Show Add to Cart / Hide Price on Hover

For our desktop view we can afford to hide our add to cart. I think it looks better then a page full of buttons.

@media (min-width: 768px) {

    .woocommerce ul.products li.product a.button {
        transform: translateY(0);
        width: 100%;
        opacity: 0;
        transition: all 0.4s;
    }

    .woocommerce ul.products li.product:hover a.button,
    .woocommerce ul.products li.product:hover .price {
        transform: translateY(calc(-100% - 10px));
        opacity: 1;
    }

    .woocommerce ul.products li.product .price {
        opacity: 1;
        transition: all 0.4s;
    }

    .woocommerce ul.products li.product:hover .price {
        opacity: 0;
        transform: translateY(calc(-100% - 10px));
    }
}

171 thoughts on “The Shop”

  1. Pingback: usa viagra 100
  2. Pingback: flagyl harmful
  3. Pingback: lasix digitalis
  4. Pingback: lisinopril china
  5. Pingback: 100mg gabapentin
  6. Анна Фрейд (1895–1982) – дочь и последовательница З.
    Фрейда, основатель детского психоанализа.
    Получила педагогическое образование, работала учительницей.
    В 1918–1921 годах прошла анализ у своего отца.

    С 1918 года принимала участие в заседаниях Венского психоаналитического
    общества и в международных конгрессах.
    В 1923 году открыла собственную психоаналитическую практику, в 1924 году возглавила Венский
    психоаналитический институт, в 1926 году
    стала секретарем Международного психоаналитического общества.
    В 1938 году вместе с отцом эмигрировала в Англию, где через год открыла детский военный приют-ясли.
    С 1944-го по 1947 год избиралась Генеральным
    секретарем Международной психоаналитической
    ассоциации. Открыла курсы подготовки детских психоаналитиков и в 1952 году
    стала директором клиники детской терапии в Хемпстеде.

    Почетный доктор Гарвардского
    и Колумбийского университетов.
    В 1973 году избрана почетным президентом Международной психоаналитической ассоциации.
    Автор книг «Введение в технику детского психоанализа»
    (1927), «Я и механизмы защиты» (1936), «Норма и патология детства» (1965).
    Работала над изданием собрания
    сочинений 3. Фрейда, которое вышло в Лондоне
    в 1942–1945 годах. спиральная динамика дон бек

  7. Pingback: effexor xr dosage
  8. Pingback: losartan (cozaar)
  9. Pingback: celexa lexapro
  10. Pingback: goodrx augmentin
  11. Pingback: stopping remeron
  12. Pingback: synthroid coq10
  13. Pingback: ivermectin 12 mg
  14. Pingback: find tadalafil
  15. Pingback: buy levitra
  16. Pingback: stromectol buy uk
  17. Pingback: ivermectin gel
  18. Pingback: research tadalafil
  19. Pingback: flagyl drug class
  20. Pingback: cephalexin cost
  21. Temp Mail I’m often to blogging and i really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand spanking new information.

  22. Wonderful web site Lots of useful info here Im sending it to a few friends ans additionally sharing in delicious And obviously thanks to your effort

  23. helloI really like your writing so a lot share we keep up a correspondence extra approximately your post on AOL I need an expert in this house to unravel my problem May be that is you Taking a look ahead to see you

  24. I just could not leave your web site before suggesting that I really enjoyed the standard information a person supply to your visitors Is gonna be again steadily in order to check up on new posts

  25. Hello Neat post Theres an issue together with your site in internet explorer would check this IE still is the marketplace chief and a large element of other folks will leave out your magnificent writing due to this problem

  26. Usually I do not read article on blogs however I would like to say that this writeup very compelled me to take a look at and do it Your writing style has been amazed me Thank you very nice article

  27. I am not sure where youre getting your info but good topic I needs to spend some time learning much more or understanding more Thanks for magnificent info I was looking for this information for my mission

  28. Business dicker naturally like your web site however you need to take a look at the spelling on several of your posts. A number of them are rife with spelling problems and I find it very bothersome to tell the truth on the other hand I will surely come again again.

  29. O que eu não entendi é que, na verdade, você não é muito mais inteligente do que seria agora. Você é muito inteligente. Você sabe muito sobre esse assunto e me fez acreditar nisso de vários ângulos diferentes. É como se mulheres e homens fossem não estou interessado, exceto que é uma coisa a realizar com Woman gaga Suas próprias coisas são excelentes Sempre cuide disso

  30. Program iz This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!

  31. Techno rozen naturally like your web site however you need to take a look at the spelling on several of your posts. A number of them are rife with spelling problems and I find it very bothersome to tell the truth on the other hand I will surely come again again.

  32. Its like you read my mind You appear to know a lot about this like you wrote the book in it or something I think that you could do with some pics to drive the message home a little bit but instead of that this is fantastic blog An excellent read I will certainly be back

  33. Hello Neat post Theres an issue together with your site in internet explorer would check this IE still is the marketplace chief and a large element of other folks will leave out your magnificent writing due to this problem

  34. I have read some excellent stuff here Definitely value bookmarking for revisiting I wonder how much effort you put to make the sort of excellent informative website

  35. you are truly a just right webmaster The site loading speed is incredible It kind of feels that youre doing any distinctive trick In addition The contents are masterwork you have done a great activity in this matter

  36. of course like your website but you have to check the spelling on several of your posts A number of them are rife with spelling issues and I in finding it very troublesome to inform the reality on the other hand I will certainly come back again

  37. للتطبيقات في البيئات المسببة للتآكل، يقدم مصنع إيليت بايب أنابيب التيتانيوم التي توفر قوة لا مثيل لها ومقاومة فائقة. هذه الأنابيب مثالية للصناعات التي تتطلب أداءً متميزًا تحت الظروف القاسية. التزامنا بالجودة يجعل مصنع إيليت بايب الخيار الأول في العراق لأنابيب التيتانيوم. اكتشف المزيد عن منتجاتنا على elitepipeiraq.com.

Leave a Comment