Skip to content

Instantly share code, notes, and snippets.

@newloong
newloong / gist:ca3c996b027cc196da7e4f75aff6456c
Created December 6, 2018 04:08 — forked from adamrosloniec/gist:a3995cc3aec2537d7ee4
wordpress acf bootstrap carousel - simple example
// bootstrap carousel build with wordpress acf - simple method
// with add class 'active' to first div - MUST BE!
// also you must add css:
// .item {display:none;}
// .item.active {display:block;}
// first method
<ul id="carousel" class="slider carousel" data-ride="carousel" data-interval="<?php if ( get_field('slider__speed','option') ) { the_field('slider__speed','option'); } else { echo '4000'; } ?>"><!-- add sub_field to change slide time --!>
<?php if ( have_rows('slider__item','option') ) : ?> <!-- take slides from Options Page > slider__item -->
@newloong
newloong / backup.sh
Created December 13, 2018 10:12 — forked from MrTrustor/backup.sh
Simple backup with Duplicity and AWS Glacier
#!/bin/bash
# Copyright 2017 Théo Chamley
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
@newloong
newloong / aggregate_files.php
Created December 19, 2018 02:50 — forked from steveclason/aggregate_files.php
Override Header Layout in Avada Child Theme
<?php
/* Override (modify) the Avada header layouts in a child theme by establishing a local version. */
/* Avada has 6 header layouts selectable via Avada > Theme Options > Header > Header Content. These map to files at
"/wp-content/themes/Avada/templates". You can use your browser's devtools to look in the header for something like
'<div class="fusion-header-v1 ... ">' which will help identify what's being used, if you don't already know.
*/
// Copy this block from "/wp-content/themes/Avada/templates/header.php". If you are not using header_1 then copy the appropriate block.
if ( ! function_exists( 'avada_header_1' ) ) {
/**
* jQuery iLightBox - Revolutionary Lightbox Plugin
* http://www.ilightbox.net/
*
* @version: 2.2.3 - June 03, 2017
*
* @author: Hemn Chawroka
* http://www.iprodev.com/
*
*/
@newloong
newloong / Bootstrap4Nav-Sage9.md
Created February 13, 2019 13:53 — forked from smutek/Bootstrap4Nav-Sage9.md
Bootstrap 4 Walker for Sage 9

Credit

This is a frankensteind version of the current Soil nav walker, by the Roots team, and Michael Remoero's Sagextras walker. All credit goes to those good folks. :)

Use

  • Replace the contents of header.blade.php with the attached header.
  • Copy the walker.php file to the /app directory.
  • Add walker.php to the Sage required files array in resources/functions.php - eg. on a stock Sage install the entry would look like:
/**
@newloong
newloong / shadowsocks_ubuntu1604.org
Created March 16, 2019 00:13
Install Shadowsocks-libev + simple-obfs on Ubuntu 16.04

Install Shadowsocks-libev + simple-obfs on Ubuntu 16.04

Install shadowsocks-libev via Ubuntu PPA

sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:max-c-lv/shadowsocks-libev -y
sudo apt-get update
sudo apt install shadowsocks-libev
@newloong
newloong / gist:a195854deeca50831daa553c1347f477
Created April 3, 2019 07:54 — forked from alimd/gist:3865955
Create A Somple Product Catalog width Wordpress.

ali.md/pcwp

Step One: Create the custom post type

The following code goes into the functions.php file:

// Create A Somple Product Catalog width Wordpress. ali.md/pcwp
// Step One: Create the custom post type
@newloong
newloong / Development.md
Created April 8, 2019 03:37 — forked from bfintal/Development.md
Creating a Custom Client WordPress Website from A PSD Design - A Gambit Technologies, Inc. Developer Guide

Creating a Custom Client WordPress Website from A PSD Design

(This is a Gambit Technologies, Inc. Developer Guide)

Development of a website from scratch is done by:

  1. Creating a customized WordPress theme using Sage by Roots,
  2. Creating the pages then creating the content either using a page builder, or by adding pure HTML content, then adding styles into the customized theme,
  3. Installing plugins from the WordPress plugin directory for added functionality, configuring them and customizing their styles.

We will use the following tools/projects/code bases:

@newloong
newloong / wp-bootstrap4.1-pagination.php
Created April 14, 2019 04:35 — forked from mtx-z/wp-bootstrap4.4-pagination.php
Wordpress Bootstrap 4.1 pagination (with custom WP_Query() and global $wp_query support)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
*
* @return string
* Accepts a WP_Query instance to build pagination (for custom wp_query()),
* or nothing to use the current global $wp_query (eg: taxonomy term page)
* - Tested on WP 4.9.5
@newloong
newloong / numeric-page-navi.php
Created April 14, 2019 04:35 — forked from kennyeliason/numeric-page-navi.php
Numeric Page Navigation for Roots Sage Theme
// Numeric Page Navi
function page_navi($before = '', $after = '')
{
global $wpdb, $wp_query;
$request = $wp_query->request;
$posts_per_page = intval(get_query_var('posts_per_page'));
$paged = intval(get_query_var('paged'));
$numposts = $wp_query->found_posts;
$max_page = $wp_query->max_num_pages;
if ($numposts <= $posts_per_page) {return;}