Skip to content

Instantly share code, notes, and snippets.

View AlexWebLab's full-sized avatar

Alex AlexWebLab

View GitHub Profile
@AlexWebLab
AlexWebLab / index.php
Created March 13, 2018 10:05
Get page ID by template name in WordPress
<?php
$args = [
'post_type' => 'page',
'fields' => 'ids',
'nopaging' => true,
'meta_key' => '_wp_page_template',
'meta_value' => 'page-special.php'
];
$pages = get_posts( $args );
foreach ( $pages as $page )
@AlexWebLab
AlexWebLab / geoip.js
Created August 20, 2018 03:04 — forked from panoply/geoip.js
GeoIP Redirect using javascript
<script>
function geo(a) {
switch (a.country.code)
{
case "SE": // Redirect is visitor from Sweden
case "NO": // Redirect is visitor from Norway
case "DK": // Redirect is visitor from Denmark
window.location = "https://se.brixtol.com" + window.location.pathname; // edit for your URL
break;
default:
@AlexWebLab
AlexWebLab / string-utils.js
Created September 11, 2018 08:30 — forked from jonlabelle/string-utils.js
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str){
return str.toLowerCase();
after
{{item.variant.title}}
add
<span class="saso-cart-item-discount-notes" data-key="{{item.key}}"></span>
<span class="saso-cart-item-upsell-notes" data-key="{{item.key}}"></span>
==
<!-- /templates/product.liquid -->
{% include 'buyx-product' with product %}
{% include 'buyx-price-min' with product %}
<div itemscope itemtype="http://schema.org/Product">
<meta itemprop="url" content="{{ shop.url }}{{ product.url }}">
<meta itemprop="image" content="{{ product.featured_image.src | img_url: 'grande' }}">
{% unless grid_item_width %}
{% assign grid_item_width = 'large--one-third medium--one-half' %}
{% endunless %}
{% include 'buyx-price-min' with product %}
{% assign on_sale = false %}
{% if product.compare_at_price > buyx_price_min %}
{% assign on_sale = true %}
<script data-cfasync="false" >
window.saso_config = {
upsell_variant_choose_option: "please select",
upsell_variant_choose_message: "Please select an option",
translate_percent_off: '% Off'
}
</script>
<div data-section-type="cart-template">
<div class="page-header">
<h1 class="majortitle">{{ 'cart.general.title' | t }}</h1>
</div>
{% if cart.items == empty %}
<div class="row-spacing align-centre">
<p>{{ 'cart.general.empty' | t }}</p>
</div>
{% else %}
# Insomnia Configuration
## Run the test query
{
shop {
id
name
}
}
# Query Structure Examples