Skip to content

Instantly share code, notes, and snippets.

@timoleinio
timoleinio / wp-config.php
Last active December 21, 2015 17:59
Allow WordPress multisite
define( 'WP_ALLOW_MULTISITE', true );
@timoleinio
timoleinio / functions.php
Last active December 20, 2015 03:18
WPSocialite PHP example.
<?php
$args = array(
'size' => 'large', //choose which size buttons to display.
'url' => 'http://esimerkki.fi', //use this to override the url that is sent to WPSocialite. Not recommended to use in loop.
'button_override' => 'facebook,twitter-share,twitter-follow,pinterest,linkedin,gplus,stumbleupon' //used to override buttons that are displayed. Add and remove as needed.
);
wpsocialite_markup( $args ); ?>
@timoleinio
timoleinio / example
Last active December 20, 2015 03:18
WPSocialite shortcode example
[wpsocialite size="small" url="http://esimerkki.fi" button_override="facebook,twitter-share,twitter-follow,pinterest,linkedin,gplus,stumbleupon"]
@timoleinio
timoleinio / 404.php
Last active December 19, 2015 19:38
<?php
//Ylätunniste
get_header(); ?>
<div class="post hentry">
<!-- Sivua ei löytynyt ilmoitus -->
<h1 class="entry-title">Voi ei! Hakemaasi sivua ei löydy.</h1>
<div class="entry-content">
<p>
Olemme pahoillamme, sillä sivua, jota yritit hakea, ei löytynyt. Osoite on saattanut vanhentua. Voit yrittää käyttää hakua, tai etsiä tietoa alla olevan tiedon perusteella.
</p>
@timoleinio
timoleinio / wp-config.php
Created July 6, 2013 18:01
Disable file editing in WordPress.
define( 'DISALLOW_FILE_EDIT', true );
@timoleinio
timoleinio / maintenance.php
Created July 3, 2013 20:18
WordPress maintenance.php example
<?php
// Return http response 503 service unavailable. This is important for SEO too!
$protocol = $_SERVER["SERVER_PROTOCOL"];
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) $protocol = 'HTTP/1.0';
header( "$protocol 503 Service Unavailable", true, 503 );
header( 'Content-Type: text/html; charset=utf-8' );
header( 'Retry-After: 600' ); // 10 minutes
?>
<!DOCTYPE html>
<html>
on_sent_ok: "location = 'http://wpopas.fi/';"
@timoleinio
timoleinio / functions.php
Last active December 18, 2015 00:59
Example how to create your own shortcode
<?php
add_shortcode('moikka', 'moikka_maailma');
function moikka_maailma(){
return 'Moikka maailma!';
}
?>
@timoleinio
timoleinio / shortcode
Created June 3, 2013 19:26
Example of escaped shortcode
[[gallery link="file" columns="3" ids="22,21,17"]]