Skip to content

Instantly share code, notes, and snippets.

View mairagall's full-sized avatar

Maira mairagall

  • Argentina
View GitHub Profile
@kartikparmar
kartikparmar / aaptc_add_product_to_cart.php
Created November 5, 2017 18:31
Adding product to cart on Add to Cart click
<?php
/*
* Automatically adding the product to the cart.
*/
function aaptc_add_product_to_cart( $item_key, $product_id ) {
$product_category_id = 123; // cricket bat category id
@kartikparmar
kartikparmar / aaptc_add_product_to_cart.php
Last active October 18, 2021 09:05
Adding product to cart on website visit
<?php
/*
* Automatically adding the product to the cart.
*/
function aaptc_add_product_to_cart() {
if ( ! is_admin() ) {
$product_id = 12986; // Product Id of the free product which will get added to cart
$found = false;
@carasmo
carasmo / read-more.php
Last active August 2, 2016 19:32
Check for the default <!--more--> and change it but leave custom <!--more Custom Text--> alone
<?php
// don't use
/** ======================================================================================
*
* Read More the_content_more_link
* Check for the default <!--more--> and change it
* but leave custom <!--more Custom Text--> alone
*
======================================================================================= */
@carasmo
carasmo / single-product.php
Last active July 11, 2016 22:14
For Genesis Child Theme (or any child theme, or change the path on the load_template if a parent theme). These instructions will help you show a different single product template page based on the category slug. If this was helpful, saved you hours of time, please consider a small donation via PayPal to christinabeymer@gmail.com.
<?php
/** ====================================================================================
* Return single product template page based on category slug
==================================================================================== **/
/** ========== Instructions ========================================================
@oliverdoetsch
oliverdoetsch / AND_OR_NOT
Last active January 22, 2023 17:03
Blogger: Globally conditional data tags for all page types
#AND
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<!--search_page AND index_page-->
</b:if>
</b:if>
#OR
@srikat
srikat / functions.php
Created January 16, 2014 17:33
Wrapping Primary and Secondary Navigation in custom divs in Genesis
//* Wrap .nav-primary in a custom div
add_filter( 'genesis_do_nav', 'genesis_child_nav', 10, 3 );
function genesis_child_nav($nav_output, $nav, $args) {
return '<div class="nav-primary-wrapper">' . $nav_output . '</div>';
}
//* Wrap .nav-secondary in a custom div
add_filter( 'genesis_do_subnav', 'genesis_child_subnav', 10, 3 );