Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Dennis Ploetner lloc

🏠
Working from home
View GitHub Profile
View default
...
server {
...
access_log /var/log/nginx/example-access.log;
access_log /var/log/nginx/example-mine.log mine;
...
}
View nginx.conf
...
http {
...
log_format mine '$uri - $blogid : $http_host';
...
}
View MslsGetSet.php
$obj = new MslsGetSet;
$obj->tmp = 'test';
$val = $obj->get_arr(); // array( 'tmp' => 'test' ) == $val
$val = $obj->has_value( 'tmp' ); // true == $val
$val = $obj->is_empty(); // false == $val
echo $obj->tmp; // Output: test
$obj->reset();
View load-js-with-conditional-tags.php
<?php
function my_enqueue_script() {
if ( is_page() ) {
wp_enqueue_script( 'page', plugins_url( '/js/page.js', __FILE__ ) );
} else {
wp_enqueue_script( 'rest', plugins_url( '/js/rest.js', __FILE__ ) );
}
}
add_action( 'wp_enqueue_scripts', 'my_enqueue_script' );
View wp-query-ref.php
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@lloc
lloc / available-mail-hooks.php
Last active Aug 29, 2015
WordPress Mail Hools
View available-mail-hooks.php
<?php
/**
* Filter the wp_mail() arguments.
*
* @since 2.2.0
*
* @param array $args A compacted array of wp_mail() arguments, including the "to" email,
* subject, message, headers, and attachments values.
*/
View .htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
@lloc
lloc / my_msls_blog_collection_get.php
Last active Sep 27, 2015
Multisite Language Switcher: Howto use the "msls_blog_collection_get"-filter
View my_msls_blog_collection_get.php
<?php
function my_msls_blog_collection_get( $objects ) {
$objects = array();
$blogs = array( 1 => 'Override English', 2 => 'Override Deutsch', );
foreach ( $blogs as $id => $description ) {
$details = get_blog_details( $id );
if ( is_object( $details ) ) {
$objects[$id] = new MslsBlog( $details, $description );
}
You can’t perform that action at this time.