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 | |
// This function will return "now", "3 seconds ago", "1 month ago" etc ... | |
function get_the_relative_time($time = null) | |
{ | |
if(is_null($time)) $time = get_the_time("U"); | |
$time_diff = date("U") - $time; // difference in second | |
$second = 1; | |
$minute = 60; |
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 | |
//Force SSL so that passwords aren't sent in the clear. | |
if($_SERVER["HTTPS"] != "on") { | |
header("HTTP/1.1 301 Moved Permanently"); | |
header("Location: https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]); | |
exit(); | |
} | |
//Here's where the Wordpress magic happens. |
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
.fc { | |
direction: ltr; | |
text-align: left; } | |
.fc table { | |
border-collapse: collapse; | |
border-spacing: 0; } | |
.fc .btn { | |
line-height: 1.2em; } | |
html .fc { |
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 | |
$rss = simplexml_load_file($argv[1]); | |
foreach ($rss->channel->item as $item) { | |
exec('wget --continue --directory-prefix="enclosures" ' . escapeshellarg($item->enclosure['url'])); | |
} |
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 | |
// get next and prev products | |
// Author: Georgy Bunin ([email protected]) | |
// forked from https://gist.github.com/2176823 | |
function ShowLinkToProduct($post_id, $categories_as_array, $label) { | |
// get post according post id | |
$query_args = array( 'post__in' => array($post_id), 'posts_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'tax_query' => array( | |
array( | |
'taxonomy' => 'product_cat', |
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 | |
/* Getting a JSON Facebook Feed | |
========================================================================== | |
1. Sign in as a developer at https://developers.facebook.com/ | |
2. Click "Create New App" at https://developers.facebook.com/apps | |
3. Under Apps Settings, find the App ID and App Secret |
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/bash | |
# encode.sh | |
# | |
# Copyright (c) 2013 Don Melton | |
# | |
# This version published on June 7, 2013. | |
# | |
# Re-encode video files in a format suitable for playback on Apple TV, Roku 3, | |
# iOS, OS X, etc. |
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
#read more here http://tautt.com/best-nginx-configuration-for-security/ | |
#don't send the nginx version number in error pages and Server header | |
server_tokens off; | |
# config to don't allow the browser to render the page inside an frame or iframe | |
# and avoid clickjacking | |
add_header X-Frame-Options SAMEORIGIN; | |
# when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header, |
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 | |
/** | |
* Plugin Name: WooCommerce Settings Tab Demo | |
* Plugin URI: https://gist.github.com/BFTrick/b5e3afa6f4f83ba2e54a | |
* Description: A plugin demonstrating how to add a WooCommerce settings tab. | |
* Author: Patrick Rauland | |
* Author URI: http://speakinginbytes.com/ | |
* Version: 1.0 | |
* | |
* This program is free software: you can redistribute it and/or modify |
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 | |
// This file assumes that you have included the nav walker from https://github.com/twittem/wp-bootstrap-navwalker | |
// somewhere in your theme. | |
?> | |
<header class="banner navbar navbar-default navbar-static-top" role="banner"> | |
<div class="container"> | |
<div class="navbar-header"> | |
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> | |
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span> |
OlderNewer