Skip to content

Instantly share code, notes, and snippets.

Olaf Lederer finalwebsites

Block or report user

Report or block finalwebsites

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
finalwebsites / check-old-mailing-list.php
Created Apr 25, 2019
Check your old mailing list with the Mailboxlayer API and the results in a CSV file
View check-old-mailing-list.php
ini_set('memory_limit', '1024M'); // should be enough for thousands of email addresses
$fp = fopen('emails-checked.csv', 'w');
fputcsv($fp, array('Email address', 'Valid MX', 'Valid SMTP', 'Score'));
$count = 0;
finalwebsites / example-json-local-business.php
Created Feb 17, 2019
Example JSON code for local business notations (use this snippet with WordPress)
View example-json-local-business.php
// place this code into your theme's functions.php file
add_action('wp_head', function() {
echo '
<script type="application/ld+json">
"@context": "",
"@type": "LocalBusiness",
finalwebsites / tpl-rss-feed-for-mailchimp.php
Last active Jan 27, 2019
Page template to create RSS campaigns with WordPress and Mailchimp
View tpl-rss-feed-for-mailchimp.php
Template Name: Custom RSS Feed
$numposts = 5;
$numchars = 300;
$thumbformat = 'medium';
$alt_text = 'Klik hier voor de afbeelding...';
finalwebsites / woocommerce-custom-category-name.php
Created Jan 22, 2019
Add parent product category names to the woocommerce_page_title() function (hook)
View woocommerce-custom-category-name.php
add_filter( 'woocommerce_page_title', 'custom_woocommerce_page_title');
function custom_woocommerce_page_title( $page_title ) {
$queried_object = get_queried_object();
if ($queried_object->taxonomy == 'product_cat') {
$tid = $queried_object->parent;
while ($tid > 0) {
if ($parent_obj = get_term($tid, 'product_cat')) {
$tid = $parent_obj->parent;
$page_title = $parent_obj->name . ' &gt; ' . $page_title;
View doofinder-embedded-layer.js
var doofinder_script ='//';
(function(d,t){var f=d.createElement(t),s=d.getElementsByTagName(t)[0];f.async=1;
var dfEmbeddedLayers = [{
"queryInput": "#s",
"hashid": 'enter here your hashid',
"zone": "eu1",
finalwebsites / migrate-serverpilot-apps.php
Created Oct 29, 2018
Migrate Serverpilot all apps from old server to a new server
View migrate-serverpilot-apps.php
// the Serverpilot wrapper, get it the class from
include_once 'ServerPilot.php';
$sp_id = 'SPCLIENTID';
$api_key = 'SPAPIKEY';
// you can find those id's in the URL from your Serverpilot application
$from_server = 'MIGRATEFROM';
$to_server = 'MIGRATETO';
finalwebsites / add-file-ext-media-upload.php
Created Sep 30, 2018
Extra bestandstypen mogelijk maken voor de WordPress upload functie
View add-file-ext-media-upload.php
// Plaats deze code in het functions.php bestand van je WordPress (child) theme
// Let op, niet alle bestandstypes zijn veilig voor de uploadfunctie.
function fws_add_file_types_to_uploads($file_types){
$new_filetypes = array();
$new_filetypes['svg'] = 'image/svg+xml';
$new_filetypes['zip'] = 'application/zip';
$file_types = array_merge($file_types, $new_filetypes );
return $file_types;
finalwebsites / add_noindex_for_feeds.php
Created Aug 15, 2018
Add noindex to your WordPress website using the X-Robots-Tag header
View add_noindex_for_feeds.php
// add this code to your theme's functions.php file
function add_noindex_for_feeds($headers) {
$req_uri = filter_input(INPUT_SERVER, 'REQUEST_URI');
if ( '/feed/' == substr($req_uri, -6) ) {
$headers['X-Robots-Tag'] = 'noindex';
return $headers;
finalwebsites / force-login-before-checkout.php
Last active Aug 12, 2018
This snippet for WooCommerce will force your customers to login or register before they can enter the checkout page.
View force-login-before-checkout.php
Redirect customers from the checkout page to the my account page
Conditions: not logged in, no guest checkout and not yes received an order
The query var redirect_to_checkout, this one is used to redirect back to the checkout after login or registration
function checkout_template_redirect() {
global $wp;
$guest = get_query_var( 'guest', '' );
finalwebsites / general-functions.php
Created Mar 14, 2018
General functions from the Jupiter theme (snippet)
View general-functions.php
* Add a widget to the dashboard.
* This function is hooked into the 'wp_dashboard_setup' action below.
function mk_posts_like_stats_widget() {
wp_add_dashboard_widget('mk_posts_like_stats', 'Popular Post Stats', 'mk_posts_like_stats_func');
You can’t perform that action at this time.