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 -ue | |
#Invoice Ninja Self-Hosted Automatic Update | |
#This version will check https://invoiceninja.org for an updated version and install if found. | |
#Tested and works with cron. Lines 51, 54, & 79 output timestamps so you can pipe to a logfile. | |
#USE AT YOUR OWN RISK | |
#Replace lines 13, 57, and 62 with your specifics (omit <>), obviously. | |
#!!IMPORTANT!! Be sure to edit lines 16 & 17 if www-data is not the owner/group for /ninja/storage! | |
#SET INITIAL VARIABLES |
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
$('#search').keyup(function() { | |
// Input field was changed (or typed into). | |
// If input contains any text. | |
if ($(this).val() != '') { | |
// Convert search term(s) to lowercase, split into words. | |
var searchTerms = $(this).val().toLowerCase().split(/\s+/); | |
// Traverse all results table rows. Well, except the header row. | |
$('#results tbody tr').each(function() { |
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 | |
/** | |
* Turns posts created through "Press This" into "read" posts. | |
*/ | |
add_filter( 'press_this_save_post', function( $data ) { | |
$data['post_type'] = 'iwcpt_read'; | |
$content = wp_unslash( $data['post_content'] ); |
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 | |
/** | |
* Quick and dirty way to import a Twitter export into WordPress | |
*/ | |
define('WP_USE_THEMES', false); | |
require './wordpress/wp-load.php'; | |
$username = '<your-username>'; |
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 | |
add_action( 'after_micropub', function( $input, $wp_args ) { | |
if ( empty( $wp_args['ID'] ) || empty( $input['properties']['bookmark-of'][0] ) ) { | |
// Micropub request did not involve a (bookmark) post. | |
return; | |
} | |
set_post_format( $wp_args['ID'], 'link' ); | |
}, 10, 2 ); |
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 | |
/** | |
* Post "Reads" to F-Stop, a feed reader not unlike Aperture. | |
*/ | |
add_filter( 'wp_insert_post_data', function( $data, $postarr ) { | |
if ( ! empty( $postarr['ID'] ) ) { | |
// Not a new post. Bail. | |
return $data; | |
} |
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 | |
/** | |
* Adds a "copy" of your site's "blog" page at `/stream/`. Visit "Settings > | |
* Permalinks" to flush rewrite rules after adding this code. | |
*/ | |
add_action( 'init', function() { | |
add_rewrite_rule( '^stream/feed/?', 'index.php?feed=rss2', 'top' ); | |
add_rewrite_rule( '^stream/page/([0-9]{1,})/?', 'index.php?paged=$matches[1]', 'top' ); | |
add_rewrite_rule( '^stream/?', 'index.php', 'top' ); |
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 | |
add_action( 'webmention_post_send', function( $response, $source, $target, $post_id ) { | |
if ( is_wp_error( $response ) ) { | |
// Something went wrong. | |
error_log( 'Error trying to send webmention to ' . esc_url_raw( $target ) . ': ' . $response->get_error_message() ); | |
} else { | |
error_log( 'Sent webmention to ' . esc_url_raw( $target ) . '; response code: ' . wp_remote_retrieve_response_code( $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
<?php | |
/** | |
* Plugin Name: Webmention Widget | |
* Description: Add recent webmentions’ status to WordPress’ dashboard. | |
* Version: 0.1 | |
* Author: Jan Boddez | |
* Author URI: https://jan.boddez.net/ | |
* License: GNU General Public License v2 or later | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
* |
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 | |
add_filter( 'pre_get_posts', function( $query ) { | |
if ( is_admin() ) { | |
return $query; | |
} | |
if ( is_feed() ) { | |
return $query; | |
} |
OlderNewer