Skip to content

Instantly share code, notes, and snippets.

Avatar
👋
Hallo! 😀

Thorsten Frommen tfrommen

👋
Hallo! 😀
View GitHub Profile
@tfrommen
tfrommen / NetworkState.php
Last active Sep 7, 2016
Save and restore the current WordPress network state.
View NetworkState.php
<?php
/**
* Save and restore the current network state.
*
* By using this class, you can avoid unnecessary
* switch_to_blog()-restore_current_blog()-switch_to_blog()-... excesses.
*/
class NetworkState {
@tfrommen
tfrommen / adapt-redirect-url-fallback.php
Created Aug 9, 2016
Adapt the redirect target URL fallback (which is the home page by default).
View adapt-redirect-url-fallback.php
<?php # -*- coding: utf-8 -*-
add_filter( 'mlp_redirect_url', function ( $url, array $match ) {
// If this is the home page, any URL is fine.
if ( is_home() || is_front_page() ) {
return $url;
}
// Prepare the HTTP language code.
@tfrommen
tfrommen / mlp-redirect-on-front-page-only.php
Last active Aug 2, 2016
Configure MultilingualPress to only redirect users on the front page
View mlp-redirect-on-front-page-only.php
<?php # -*- coding: utf-8 -*-
add_action( 'inpsyde_mlp_init', function () {
remove_action( 'inpsyde_mlp_loaded', 'mlp_feature_redirect' );
} );
add_action( 'mlp_and_wp_loaded', function ( Inpsyde_Property_List_Interface $plugin_data ) {
if (
@tfrommen
tfrommen / mlp-hide-non-public-sites.php
Last active Sep 15, 2015 — forked from bueltge/mlp-filter-site.php
This is a simple add-on for the MultilingualPress plugin to hide non-public sites (i.e., languages) from translation lists such as the Language Switcher widget or the Quicklinks.
View mlp-hide-non-public-sites.php
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Hide Non-public Sites
* Description: This is a simple add-on for the MultilingualPress plugin to hide non-public sites (i.e., languages) from translation lists such as the Language Switcher widget or the Quicklinks.
* Author: Inpsyde GmbH, tf
* Author URI: http://inpsyde.com
* Version: 2015-09-16
* License: GPL-3.0
* Network: true
*/
View gist:9669782
<?php
/**
* Add Gravity Forms capabilities.
*/
add_filter( 'user_has_cap',
function( $caps ) {
if ( ! empty( $caps[ 'edit_pages' ] ) )
// user has edit capabilities
foreach ( array(
'gravityforms_delete_entries',
You can’t perform that action at this time.