Skip to content

Instantly share code, notes, and snippets.

View anilmeena's full-sized avatar

Anil Meena anilmeena

View GitHub Profile
@anilmeena
anilmeena / multiple-navigation-menu-shopify
Created October 15, 2016 16:06
Multiple Navigation Menu in Shopify
<nav role="navigation">
<ul>
{% for link in linklists.main-menu.links %}
{% assign child_list_handle = link.title | handle %}
{% if linklists[child_list_handle] and linklists[child_list_handle].links.size > 0 %}
<li class="has-dropdown">
{{ link.title | link_to: link.url }}
<ul>
{% for child_link in linklists[child_list_handle].links %}
{% assign grand_child_list_handle = child_link.title | handle %}
@anilmeena
anilmeena / multilevel-navigation-menu-shopify.txt
Created October 15, 2016 16:01
Multilevel Navigation Menu in Shopify
<ul class="horizontal unstyled clearfix">
{% for link in linklists.main-menu.links %}
{% if linklists[link.handle] == empty %}
<li>
<a href="{{ link.url }}" class="{% if link.active %} current{% endif %}">
<span>{{ link.title }}</span></a>
</li>
{% else %}
<!-- Menu level 1 -->
<li class="dropdown"><a href="{{ link.url }}" class="{% if link.active %} current{% endif %}">
@anilmeena
anilmeena / get-pages-title-content-handle.txt
Created October 15, 2016 15:59
Get a Page’s Title, Content and More With The Handle
/* Get a Page’s Title, Content and More With The Handle */
/* Method 1 */
{{ pages['about-us'].title }}
{{ pages['about-us'].content }}
/* Method 2 */
{% assign my_var = "about-us" %}
{{ pages[my_var].title }}
{{ pages[my_var].content }}
@anilmeena
anilmeena / display-collection-image-outside-collection-page.txt
Created October 9, 2016 08:51
Display collection image outside of collection page
// Display collection image outside of collection page
{% assign collection = collections.my-collection-handle %}
{% if collection.image %}
<img src="{{ collection.image.src | collection_img_url: 'original' }}" alt="{{ collection.image.alt }}" />
{% endif %}
@anilmeena
anilmeena / display-products-collections-loop.txt
Created October 9, 2016 08:34
Display all products from same Collections in loop
/* Display all products from same Collections in loop */
<ul>
{% for product in collections.collection-1.products %}
<li{% cycle 'group1': ' style="clear:both;"', '', '', ' class="last"' %}>
<a href="{{ product.url | within: collection }}">
<img src="{{ product.featured_image.src | product_img_url: "medium" }}" alt="{{ product.featured_image.alt }}" />
</a>
</li>
{% endfor %}
@anilmeena
anilmeena / get-thumbnail-image-youtube-video.php
Created October 9, 2016 08:10
Get thumbnail image from any youtube video
<style>
.video { position: relative; }
.video a {
position: absolute;
display: block;
background: url(play.png) no-repeat;
height: 32px;
width: 32px;
top: 28px;
@anilmeena
anilmeena / add-css-js-files-in-wp-functions.php
Created October 9, 2016 04:56
Add CSS & JS files in WP functions
<?php
/* Add CSS & JS files in WP functions */
function wp_elevate_zoom_add_scripts() {
// Load jQuery if it isn't already
wp_enqueue_script('jquery');
// Load custom jQuery
wp_register_script('wpez-min-jquery', get_bloginfo('template_url') . '/elevate-zoom/js/jquery-1.8.3.min.js', array( 'jquery' ), null, true );
wp_enqueue_script( 'wpez-min-jquery' );
@anilmeena
anilmeena / add-ajax-based-pagination-in-wordpress-loop.php
Last active November 6, 2019 20:39
Add ajax based pagination in wordpress loop
<div id="content">
<?php
$new_query = new WP_Query();
$new_query->query('post_type=post&showposts=1'.'&paged='.$paged);
?>
<?php while ($new_query->have_posts()) : $new_query->the_post(); ?>
<?php the_title(); ?>
<?php endwhile; ?>
@anilmeena
anilmeena / genesis-custom-home-page-template.php
Created October 7, 2016 03:41
Genesis Custom Home Page Template
<?php
/* Genesis Custom Home Page Template */
function child_grid_loop_helper() {
genesis_grid_loop( array(
'features' => 2,
'feature_image_size' => 'child_full',
'feature_image_class' => 'aligncenter post-image',
'feature_content_limit' => 0,
@anilmeena
anilmeena / change-evenodd-rows-background-colors.html
Created October 7, 2016 03:36
Change even/odd rows background colors
<style>
.container {
width:600px;
margin:0 auto;
}
.row {
line-height:24pt;
border: solid 1px black;
}
.row:nth-of-type(2n+1)