This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_administrative_name($lat, $lng, $level = 'administrative_area_level_2', $expire = null) { | |
if(!$expire) | |
$expire = 60 * 60 * 24 * 7 * 4; // keep for a month | |
$transient = 'cached_administrative_name_'. str_replace('.' , '', $lat) .''. str_replace('.' , '', $lng); | |
if( false === ($place = get_transient( $transient ) ) ) { | |
$city = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='.$lat.','.$lng.'&sensor=false'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
var data = { | |
action: 'smart_ajax', // the action as defined on line 8 of the PHP file | |
myVar: 'Hello World' // will be sent to the php within the $_POST global | |
}; | |
$.post(SmartAjax.ajax, data, function(response) { | |
console.log(response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
navigator.geolocation.getCurrentPosition(function(position) { | |
console.log(position.coords.latitude); // latitude | |
console.log(position.coords.longitude); // longitude | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="smart-off-canvas smart-off-canvas-right"> | |
<div class="smart-off-canvas-trigger"> | |
<img src="triggericon.png" alt="<?php _e('Open the menu', 'off-canvas'); ?>"> | |
</div> | |
<div class="smart-off-canvas-inner"> | |
<?php | |
wp_nav_menu( array('theme_location' => 'primary' ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ACTION="$1" | |
PARONE="$2" | |
PARTWO="$3" | |
PARTHREE="$4" | |
PARFOUR="$5" | |
PARFIVE="$6" | |
PARSIX="$7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach( wp_get_sites() as $site ) { | |
if( $site['blog_id'] !== 1 ) { // ikke hente roten (denne siden) | |
switch_to_blog( $site['blog_id'] ); // bytt tabellsett til bloggen | |
wp_nav_menu( array( 'theme_location' => 'primary-menu') ); // hent menyen som er assignet til primary-menu | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_livechat_visible( $display ) { | |
return 'both'; // accepted values are 'both', 'admin', 'public' or 'none'. default is 'both' | |
} | |
add_filter( 'smart_settings_show_livechat_code', 'my_livechat_visible' ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_action('order_status_pending_to_processing', 'jigoshop_processing_order_customer_notification',10); | |
remove_action('order_status_pending_to_on-hold', 'jigoshop_processing_order_customer_notification',10); | |
add_action('order_status_pending_to_processing', 'new_jigoshop_processing_order_customer_notification'); | |
add_action('order_status_pending_to_on-hold', 'new_jigoshop_processing_order_customer_notification'); | |
function new_jigoshop_processing_order_customer_notification($order_id) { | |
$jigoshop_options = Jigoshop_Base::get_options(); | |
$order = new jigoshop_order($order_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'after_setup_theme', 'myplugin_load_textdomain' ); | |
function myplugin_load_textdomain() { | |
load_plugin_textdomain( 'my-plugin', false, get_template_directory() . '/my-plugin-lang-dir-in-theme/' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lhk_instagram_feeds($limit = 6) { | |
$tags = array( 'levangerhk' ); | |
$images = get_transient( 'lhk_instagram' ); | |
if( $images === false ) { | |
$images = array(); | |
foreach($tags as $tag) { | |
$data = file_get_contents('https://api.instagram.com/v1/tags/'.$tag.'/media/recent?client_id=d5eb3a4d30224d088e98d8b1ceae2348&count=10'); | |
$data = json_decode($data); |
OlderNewer