This file contains hidden or 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 | |
// Setup Swiper before deploy | |
// http://idangero.us/swiper | |
// Add Slideshow Shortcode for WordPress | |
function slideshow_custom_shortcode($atts, $content = null ) { | |
extract( shortcode_atts( array( | |
'plain_text_url' => 'no' // in case the urls are plain text urls, write yes in the parameter eg. [slideshow plain_text_url="yes"]plain text urls here[/slideshow] | |
), $atts ) ); |
This file contains hidden or 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 | |
// PHP – parse a string between two strings | |
// Credits: http://www.justin-cook.com/wp/2006/03/31/php-parse-a-string-between-two-strings/ | |
function get_string_between($string, $start, $end){ | |
$string = " ".$string; | |
$ini = strpos($string,$start); | |
if ($ini == 0) return ""; | |
$ini += strlen($start); | |
$len = strpos($string,$end,$ini) - $ini; |
This file contains hidden or 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 id="calendar"> | |
<?php | |
// Dates | |
$year = date('Y'); | |
$first_month_this_year_ts = mktime(0, 0, 0, date("F", strtotime('first month of this year')) + 1, date('d'), date('Y')); // timestamp | |
$today = date("j F Y", strtotime('today')); // human date | |
$today_ts = strtotime('today'); // timestamp | |
$today_day_of_year = date("z", $today_ts);// int |
This file contains hidden or 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
/*DELETE FROM wp_posts; | |
DELETE FROM wp_postmeta;*/ | |
TRUNCATE TABLE wp_posts; | |
TRUNCATE TABLE wp_postmeta; |
This file contains hidden or 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 | |
/* | |
For a better understanding of ics requirements and time formats | |
please check https://gist.github.com/jakebellacera/635416 | |
*/ | |
// UTILS | |
// Check if string is a timestamp |
This file contains hidden or 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: Post Expirator | |
Plugin URI: http://wordpress.org/extend/plugins/post-expirator/ | |
Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time. | |
Author: Aaron Axelsen | |
Version: 2.1.4 | |
Author URI: http://postexpirator.tuxdocs.net/ | |
Translation: Thierry (http://palijn.info) | |
Text Domain: post-expirator |
This file contains hidden or 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 | |
// Change all pages and hierarchical custom post types to date order | |
function custom_page_order( $wp_query ) { | |
global $pagenow; | |
if (is_admin() && 'edit.php' == $pagenow && !isset($_GET['orderby'])) { | |
$wp_query->set( 'orderby', 'date' ); | |
$wp_query->set( 'order', 'DSC' ); | |
} | |
} |
This file contains hidden or 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 requires that your post type is hierarchical obviously (like Pages) | |
// Display all children of this post/page in a custom metabox below title | |
function display_msg_for_parents( $post ) { | |
$children = get_pages(array('child_of' => $post->ID, 'post_type' => get_post_type($post->ID),)); | |
if(!empty($children)) { ?> | |
<div class="rp_children postbox"> | |
<button class="handlediv button-link" aria-expanded="true" type="button"> | |
<span class="screen-reader-text">Toggle panel: Children</span> |
This file contains hidden or 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 | |
// Go to All posts by default, not Mine | |
function go_to_all() { | |
global $typenow; | |
// Use this if you need this only on specific post types | |
/*if( 'post' !== $typenow ) | |
return;*/ | |