Skip to content

Instantly share code, notes, and snippets.

View dnaber-de's full-sized avatar
🏠
Working from home

David Naber dnaber-de

🏠
Working from home
View GitHub Profile
@dnaber-de
dnaber-de / result-page.html
Created July 10, 2012 09:37
Google custom search code
<div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.de/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'de'});
google.setOnLoadCallback(function() {
var customSearchOptions = {}; var customSearchControl = new google.search.CustomSearchControl(
'*****************', customSearchOptions);
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
customSearchControl.draw('cse');
function parseParamsFromUrl() {
@dnaber-de
dnaber-de / screenshot-1.png
Created August 24, 2012 17:29
WP Multisite Plugin: non-super-admins can edit users in blog context (if they have the capabilities 'edit_users' and 'promote_users').
screenshot-1.png
@dnaber-de
dnaber-de / hands-off-from-content.php
Created August 25, 2012 11:43
WP Plugin: Don't replace 'Wordpress' with 'WordPress'. Keep ' and " as they are.
<?php
/**
* Plugin Name: dna Hands off from content
* Description: Don't replace 'Wordpress' with 'WordPress'. Keep ' and " as they are.
* Plugin URI: https://gist.github.com/3464269
* Version: 2012.08.25
* Author: David Naber
* Author URI: http://dnaber.de/
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
@dnaber-de
dnaber-de / class-Not_So_Simple_XML.php
Created August 28, 2012 17:30
This Class extends SimpleXMLElement to write CDATA-Nodes and print a formated xml-string
<?php
/**
* This Class extends SimpleXMLElement to write CDATA-Nodes and print a formated xml-string
*
* to add cdata do it like this:
* ($node is an instance of Not_So_Simple_XML)
* $node->title = NULL;
* $node->title->addCData( );
*
* @author David Naber <kontakt@dnaber.de>
@dnaber-de
dnaber-de / dna-framebreaker.php
Created November 9, 2012 13:25
Wordpress Plugin to add a framebreaker javascript to the header.
<?php
/**
* Plugin Name: dna Framebreaker
* Plugin URI: https://gist.github.com/4045656
* Description: Add a framebreaker javascript to the header. (Requires PHP 5.3)
* Version: 0.1
* Author: David Naber
* Author URI: http://dnaber.de
* License: MIT
* License URI: http://opensource.org/licenses/MIT
@dnaber-de
dnaber-de / dna-save-attachment.php
Created December 5, 2012 11:57
Worpress Plugin: Calls the action 'save_post' for Attachment Post Types. Requires PHP 5.3
<?php
/**
* Plugin Name: dna Save Attachment
* Plugin URI: https://gist.github.com/4214994
* Author: David Naber
* Author URI: http://dnaber.de/
* Version: 2014.08.24
* Description: Calls the action 'save_post' for Attachment Post Types vor WordPress versions prior 4.0. Requires PHP 5.3. The plugin will have no effect in WordPress 4.0 or higher. (Getting obsolete when <a href="http://core.trac.wordpress.org/ticket/21963">#21963</a> is fixed.)
*/
namespace DNA\SaveAttachment;
@dnaber-de
dnaber-de / dna-tpl-to-admin-bar.php
Last active April 13, 2018 15:05
WordPress plugin to show the current used template file name in the admin bar.
<?php
/**
* Plugin Name: dna Template Name to Admin Bar
* Plugin URI: https://gist.github.com/4690246
* Description: Shows the current used theme template file in the admin bar. (Requires PHP 5.3)
* Author: David Naber
* Author URI: http://dnaber.de/
* Version: 2013.11.09
* License: MIT
@dnaber-de
dnaber-de / category.php
Last active December 12, 2015 06:49
A simple Wordpress Theme for Documentation.
<?php
get_header(); ?>
<h1>Plugin: <?php single_cat_title(); ?></h1>
<h2>Verwendet in</h2>
<ul>
<?php
while ( have_posts() ) {
the_post();
?>
@dnaber-de
dnaber-de / dna-ip-to-admin-bar.php
Last active July 13, 2017 21:28
WordPress Plugin to show the Server Address (IP) in Admin-Bar
<?php
/**
* Plugin Name: dna IP to Admin Bar
* Plugin URI: https://gist.github.com/dnaber-de/5219882
* Description: Shows the current Server IP in the Admin Bar. (Requires PHP 5.3)
* Author: David Naber
* Author URI: http://dnaber.de/
* Version: 2013.03.22
* License: MIT
@dnaber-de
dnaber-de / controller.php
Created August 23, 2013 08:55
Settings-API-Helper example
<?php
namespace Example\Theme;
class Theme_Options {
/**
* the option key
*
* @const string