Skip to content

Instantly share code, notes, and snippets.

@stkdr
stkdr / functions.php
Created Jun 11, 2018 — forked from jaredatch/functions.php
WordPress Search Autocomplete using admin-ajax.php
View functions.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@stkdr
stkdr / functions.php
Created Jun 11, 2018 — forked from jaredatch/functions.php
WordPress Search Autocomplete using WP REST API v2
View functions.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@stkdr
stkdr / awesome-support-custom-fields.php
Created Jun 7, 2018 — forked from julien731/awesome-support-custom-fields.php
Awesome Support Custom Fields Starter Kit
View awesome-support-custom-fields.php
<?php
/**
* @package Awesome Support/Custom Fields
* @author ThemeAvenue <web@themeavenue.net>
* @license GPL-2.0+
* @link http://themeavenue.net
* @copyright 2014 ThemeAvenue
*
* @wordpress-plugin
* Plugin Name: Awesome Support: My Custom Fields
@stkdr
stkdr / custom-domain-localhost-xampp
Created Jun 6, 2018 — forked from oozman/custom-domain-localhost-xampp
How to add a custom domain name on your localhost using XAMPP. Codes are based on Windows, but Step 2 onwards are pretty much applicable on other operating system.
View custom-domain-localhost-xampp
Step 1:
Go to: C:\Windows\System32\Drivers\etc\hosts
And add this to the bottom of the file:
=============
127.0.0.1 your.domain.com
=============
Step 2:
Go to [your XAMPP directory]/apache/conf/httpd-xampp.conf
@stkdr
stkdr / class-wp-numeric-pagination.php
Created Apr 21, 2018 — forked from pixeline/class-wp-numeric-pagination.php
Wordpress Numeric Pagination Class that enables you to set the classes of each LI and A html tag.
View class-wp-numeric-pagination.php
<?php
/**
* Numeric Pagination Class
* @author Alexandre Plennevaux https://pixeline.be
*
* This class returns a list of LI > A. It is up to you to set the wrapping NAV > UL around your function call.
*
* @usage (setting specific classes)
*
* // Sets the css classes you want to be used for the output
@stkdr
stkdr / creatSpanTag.php
Created Dec 28, 2017 — forked from mdjwel/creatSpanTag.php
Convert a special sign to HTML Tag
View creatSpanTag.php
<?php
function Convert_to_htmlTag($string, $tagSign='|') {
$firstSign = strpos($string, $tagSign);
$lastSign = strpos($string, $tagSign, $firstSign+1);
$strArray = str_split($string);
$replaceSigns = array($firstSign=>'<span class="se-s-color">', $lastSign=>'</span>');
$replaceSigns = array_replace($strArray, $replaceSigns);
echo implode($replaceSigns);
}
View gist:b203a8faae0a97ce94f2f271cd6cfa7b
/**
* Escape translated strings with:
*/
__( ‘Hello world’, ‘text-domain’ ); _e( ‘Hello world’, ‘text-domain’ );.
/**
* If there is no HTML use:
*/
esc_html__( ‘Hello world’, ‘text-domain’ ); esc_html_e( ‘Hello world’, ‘text-domain’ );
@stkdr
stkdr / gist:1bbcdc1a4ff6087fa746e2d03d9f7a46
Created Nov 21, 2017
Disable Redux activation redirect
View gist:1bbcdc1a4ff6087fa746e2d03d9f7a46
add_action( 'redux/construct', 'radium_remove_as_plugin_flag' );
/**
* Remove plugin flag from redux. Get rid of redirect
*
* @since 1.0.0
*/
function radium_remove_as_plugin_flag() {
ReduxFramework::$_as_plugin = false;
}
View google_font.php
<?php
/*
Register Fonts
*/
function studio_fonts_url() {
$font_url = '';
/*
Translators: If there are characters in your language that are not supported
by chosen font(s), translate this to 'off'. Do not translate into your own language.