Skip to content

Instantly share code, notes, and snippets.

View kontikidigital's full-sized avatar

Kontiki Digital kontikidigital

View GitHub Profile
@ethicka
ethicka / remove-facet-count.php
Created February 3, 2020 20:27
FacetWP: Remove Facet Count
<?php
add_filter('facetwp_facet_html', function ($output, $params) {
if ('dropdown' == $params['facet']['type']) {
$output = preg_replace("/( \([0-9]+\))/m", '', $output);
}
return $output;
}, 10, 2);
@rynaldos-zz
rynaldos-zz / wc-new-tab-open.php
Last active July 2, 2020 05:25
[WooCommerce 3.0+] Open external product links (shop page) in new tab
add_filter( 'woocommerce_loop_add_to_cart_link', 'add_target_blank', 10, 2 );
function add_target_blank( $link, $product ){
if ( 'external' === $product->get_type() ) {
$link = sprintf( '<a href="%s" target="_blank" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="button product_type_%s">%s</a>',
esc_url( $product->add_to_cart_url() ),
esc_attr( $product->get_id() ),
esc_attr( $product->get_sku() ),
@dr5hn
dr5hn / functions.php
Created October 15, 2017 09:50
How to show product image on checkout page. Woocommerce
<?php
/*
* Showing Product Image on Checkout Page -- By Darshan Gada
*/
add_action('woocommerce_before_checkout_form', 'displays_cart_products_feature_image');
function displays_cart_products_feature_image() {
foreach ( WC()->cart->get_cart() as $cart_item ) {
$item = $cart_item['data'];
@vishalck
vishalck / woocommerce-change-order-received-text2.php
Created May 23, 2017 10:39
Change Text & Add External Link on Order Received Page in WooCommerce
<?php
add_filter('woocommerce_thankyou_order_received_text', 'woo_change_order_received_text', 10, 2 );
function woo_change_order_received_text( $str, $order ) {
$new_str = 'We have emailed the purchase receipt to you. Please make sure to fill <a href="http://localhost:8888/some-form.pdf">this form</a> before attending the event';
return $new_str;
}
@doubleedesign
doubleedesign / wc-show-cross-sells.php
Created May 16, 2017 01:06
WooCommerce - Show an unordered list of cross-sells on the single product page
<?php // Use on single product template ?>
<div class="related">
<?php
// Customised: Show cross-sells on single product pages, under the attributes and short description
global $post;
$crosssells = get_post_meta( $post->ID, '_crosssell_ids',true);
if($crosssells) {
echo '<h2>Related products</h2>';
echo '<ul>';
@jennimckinnon
jennimckinnon / .htaccess
Created May 7, 2017 15:21
Default .htaccess file for sub-directory installations of WordPress Multisite for versions 3.5+.
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
@mircian
mircian / gform_sections_accordion.css
Last active August 20, 2022 17:43
Transform Gravity Forms sections into an accordion with jQuery - https://mircian.com/2016/11/06/transform-gravity-forms-sections-accordion/
.m_collapse_text, .show_collapse .m_expand_text, .m_section{
display: none;
}
.show_collapse .m_collapse_text {
display: inline;
}
@harishkotra
harishkotra / wordpress_change_db_urls.sql
Created April 2, 2017 02:09
Change and Update WordPress URLS in Database When Site is Moved to new Host. After migrating a WordPress site to a new URL either to a live production site or a testing development server, the new URL strings in the mysql database need to be changed and updated in the various mysql database tables.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@Niloys7
Niloys7 / gist:17b88d36c1c38844a6cf2127c15dee63
Created February 24, 2017 01:17
Get Product Gallery Images - WooCommerce
<?php
global $product;
$attachment_ids = $product->get_gallery_attachment_ids();
foreach( $attachment_ids as $attachment_id )
{
//Get URL of Gallery Images - default wordpress image sizes
echo $Original_image_url = wp_get_attachment_url( $attachment_id );
echo $full_url = wp_get_attachment_image_src( $attachment_id, 'full' )[0];
echo $medium_url = wp_get_attachment_image_src( $attachment_id, 'medium' )[0];
@Komock
Komock / function.php
Created April 23, 2016 21:30
Genesis remove .site-inner markup
<?php
//* Remove .site-inner
add_filter( 'genesis_markup_site-inner', '__return_null' );
add_filter( 'genesis_markup_content-sidebar-wrap_output', '__return_false' );
add_filter( 'genesis_markup_content', '__return_null' );
?>