Skip to content

Instantly share code, notes, and snippets.

View yratof's full-sized avatar
🍊
Eating an orange

Andrew yratof

🍊
Eating an orange
View GitHub Profile
@yratof
yratof / colour.scss
Last active April 22, 2016 13:46
Gradient text
.colour-knock-out {
background: -webkit-linear-gradient(left, #FF4300 0%, #FFBC00 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
@yratof
yratof / functions.php
Created April 21, 2016 08:27
Visual Composer and Relevanssi showing shortcodes in search
<?php
// Issue with showing VC shortcodes in search results
// Strip out Visual Composer specific shortcodes
add_filter('relevanssi_pre_excerpt_content', 'rlv_trim_vc_shortcodes');
function rlv_trim_vc_shortcodes($content) {
$content = preg_replace('/\[\/?vc_.*?\]/', '', $content);
return $content;
}
@yratof
yratof / pi.sh
Created April 13, 2016 06:46
Raspberry Pi - Setting up x11vnc
sudo apt-get install x11vnc;
x11vnc -storepasswd;
cd .config && mkdir autostart && cd autostart && nano x11vnc.desktop
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=X11VNC
Comment=
@yratof
yratof / _wc_extra-image-catelog.php
Last active April 9, 2016 17:52
Woocommerce addtional image on category pages
<?php
// Add the first gallery image to the item within the cateogry view.
// this hooks on to the content title before hook
function woo_additional_image_on_category(){
global $product;
$attachment_ids = $product->get_gallery_attachment_ids();
if (!empty($attachment_ids)){
foreach( array_slice( $attachment_ids , 0, 1) as $attachment_id ) {
$image_link = wp_get_attachment_url( $attachment_id ); ?>
@yratof
yratof / _wc-sale-items.php
Created April 9, 2016 17:45
Woocommerce sale items via URL
<?php
// Display sale items only when searching by /?sale=show
add_action('pre_get_posts','sale_items');
function sale_items($query) {
if (!is_admin() && ( $query->is_post_type_archive( 'product' ) || $query->is_tax( get_object_taxonomies( 'product' ))) && isset($_GET['sale']) && $_GET['sale'] == 'show' ) {
$meta_query = array(
array(
'key' => '_sale_price',
'value' => 0,
@yratof
yratof / transient-article-list.php
Last active May 26, 2016 12:40
Wordpress transients
<div class="nav__articles">
<?php
// If the transient doesn't exist, do the query
$links = '';
if ( FALSE === ( $links = get_transient( '_menu_article_display_list' ) ) ) :
$args = array(
'order' => 'DESC',
'post_type' => 'post',
'show_posts' => 10,
'fields' => 'ids',
<div class="cf w">
<div class="grid w">
<i class="column column-1"><i class="gutter"></i></i>
<i class="column column-2"><i class="gutter"></i></i>
<i class="column column-3"><i class="gutter"></i></i>
<i class="column column-4"><i class="gutter"></i></i>
<i class="column column-5"><i class="gutter"></i></i>
<i class="column column-6"><i class="gutter"></i></i>
<i class="column column-7"><i class="gutter"></i></i>
<i class="column column-8"><i class="gutter"></i></i>
@yratof
yratof / map.php
Created April 1, 2016 19:50
Wordpress transients to store data from Google maps, using Advanced Custom Fields repeating fields.
<?php
$row = 'where_in_the_world'; // repeater
// Retrieve the addresses from the transient data
$stored_addresses = get_transient( 'cities_to_map_trans' );
echo '<div class="acf-map">';
foreach ($stored_addresses as $stored_address) {
echo $stored_address[ 'point' ];
}
@yratof
yratof / functions.php
Created March 29, 2016 16:39
Flipping product images for Woocommerce
<?php
// Add the first gallery image to the item within the cateogry view.
// this hooks on to the content title before hook
function vakrerom_additional_image_on_category(){
global $product;
$attachment_ids = $product->get_gallery_attachment_ids();
if (!empty($attachment_ids)){
foreach( array_slice( $attachment_ids , 0, 1) as $attachment_id ) {
$image_link = wp_get_attachment_url( $attachment_id ); ?>
<span class="image--lookbook">
@yratof
yratof / logo.php
Last active March 22, 2016 09:15
Driv logo as SVG with fallback
<svg xmlns="http://www.w3.org/2000/svg" width="241.69" height="50" viewBox="0 0 241.69 50">
<path id="driv-ident" fill="#E70000" d="M26.195 1.918c-12.61 0-22.83 10.223-22.83 22.832 0 12.603 10.22 22.826 22.83 22.826 12.61 0 22.83-10.224 22.83-22.826 0-12.608-10.22-22.832-22.83-22.832zm0 39.498V8.076c9.208 0 16.674 7.466 16.674 16.674 0 9.202-7.466 16.666-16.675 16.666z"/>
<path id="driv-type" d="M66.92 15.88c1.157 0 2.235.186 3.233.555 1 .37 1.862.923 2.592 1.66s1.3 1.662 1.71 2.77.618 2.407.618 3.9c0 1.308-.168 2.517-.503 3.624-.336 1.106-.843 2.063-1.522 2.868-.68.806-1.527 1.44-2.542 1.9-1.015.462-2.21.692-3.586.692h-7.75V15.88h7.75zm-.277 14.648c.57 0 1.124-.092 1.66-.277.538-.183 1.016-.49 1.436-.917.418-.428.754-.985 1.005-1.674.252-.69.378-1.527.378-2.518 0-.906-.088-1.724-.265-2.454-.176-.73-.465-1.354-.868-1.875-.403-.52-.936-.918-1.598-1.195-.664-.277-1.48-.416-2.454-.416h-2.82v11.326h3.525zM89.042 15.88c.806 0 1.53.13 2.177.39.645.262 1.198.618 1.66 1.07.46.454.813.98 1.057 1.574.243.596.365 1.