Skip to content

Instantly share code, notes, and snippets.

View anilmeena's full-sized avatar

Anil Meena anilmeena

View GitHub Profile
@anilmeena
anilmeena / add-capabilities-for-custom-post-type.php
Created October 7, 2016 03:16
Add Capabilities for Custom Post type
<?php
// Add Capabilities for Custom Post type
add_action( 'init', 'create_my_post_types' );
function create_my_post_types() {
register_post_type(
'movie',
array(
'public' => true,
'capability_type' => 'movie',
@anilmeena
anilmeena / genesis-category-template.php
Created October 7, 2016 03:21
Genesis category page template
<?php
// Create category.php file & put this code
/**
* Custom Category Template
**/
// Remove default loop
//remove_action( 'genesis_loop', 'genesis_do_loop' );
function wps_category_loop_args() {
return array(
'category_name' => get_query_var( 'category_name' ),
@anilmeena
anilmeena / change-the-footer-text-of-genesis-theme.php
Last active October 7, 2016 03:28
Change the footer text of genesis theme
@anilmeena
anilmeena / add-cart-price-and-quantity-in-header.txt
Created October 7, 2016 03:31
Add cart price and quantity in header
// Add cart price and quantity in header.liquid file
{{ cart.item_count }} {{ cart.item_count | pluralize: 'Item', 'Items' }} ({{ cart.total_price | money }})
@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)
@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 / 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 / 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 / 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 / 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 %}