Skip to content

Instantly share code, notes, and snippets.

View michaeloeser's full-sized avatar

Michael Oeser michaeloeser

View GitHub Profile
@michaeloeser
michaeloeser / archive.php
Created January 7, 2013 10:29
Post meta Informations
<?php get_header(); ?>
<div id="content">
<?php is_tag(); ?>
<?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<h2 class="pagetitle"><?php printf( __('%s', PRiNZ_DOMAIN), single_cat_title('', false)); ?></h2>
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<h2 class="pagetitle">
@michaeloeser
michaeloeser / wp-config.php
Last active December 11, 2015 03:28
Increase Memory Limit.
<?php
define('WP_MEMORY_LIMIT', '96M');
?>
@michaeloeser
michaeloeser / wp-config.php
Last active December 11, 2015 03:28
Empty Trash Automatically
<?php
define('EMPTY_TRASH_DAYS', 5 );
?>
@michaeloeser
michaeloeser / functions.php
Last active December 11, 2015 03:28
Detect Browser
<?php
add_filter('body_class','browser_body_class');
function browser_body_class($classes) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
@michaeloeser
michaeloeser / functions.php
Created January 15, 2013 09:27
Change Admin Logo
<?php
function custom_admin_logo() {
echo '<style type="text/css">
#header-logo { background-image: url('.get_bloginfo('template_directory').'/images/admin_logo.png) !important; }
</style>';
}
add_action('admin_head', 'custom_admin_logo');
?>
@michaeloeser
michaeloeser / functions.php
Created January 15, 2013 09:28
Customize WordPress Login Logo Without a Plugin
<?php
function my_custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url('.get_bloginfo('template_directory').'/images/custom-login-logo.gif) !important; }
</style>';
}
add_action('login_head', 'my_custom_login_logo');
?>
@michaeloeser
michaeloeser / wp-config.php
Created January 15, 2013 13:37
Limit Post Revisions
<?php
// Maximum 5 revisions
define('WP_POST_REVISIONS', 5);
// Disable revisions
define('WP_POST_REVISIONS', false);
?>
@michaeloeser
michaeloeser / functions.php
Created January 19, 2013 12:35
Restrict Admin Area To Only Admin Users
<?php
function restrict_admin()
{
if ( ! current_user_can( 'manage_options' ) ) {
wp_redirect( site_url() );
exit;
}
}
add_action( 'admin_init', 'restrict_admin', 1 );
?>
@michaeloeser
michaeloeser / sidebar.php
Created January 22, 2013 15:29
List subpages even if on a subpage
<!--display subpages if any -->
<?php
if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) { ?>
<div class="sidebar_widget subpages">
<ul>
<?php echo $children; ?>
@michaeloeser
michaeloeser / functions.php
Last active December 12, 2015 08:39
A custom WordPress Login Logo without a Plugin
<?php
function my_custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url('.get_bloginfo('template_directory').'/images/custom-login-logo.gif) !important; }
</style>';
}
add_action('login_head', 'my_custom_login_logo');
?>