Skip to content

Instantly share code, notes, and snippets.

View nickcernis's full-sized avatar

Nick Cernis nickcernis

  • Innsbruck, Austria
  • 12:45 (UTC +02:00)
View GitHub Profile
@nickcernis
nickcernis / init.sls
Created July 30, 2013 14:03
PHP 5.2.17 stack
# /srv/salt/php/init.sls
php:
pkgrepo.managed:
- ppa: skettler/php # https://launchpad.net/~skettler/+archive/php/+packages
- require_in:
- pkg: php
pkg.installed:
- name: php52
- version: 5.2.17~precise~ppa19
/* Author Box
------------------------------------------------------------ */
.author-box {
background-color: #f5f5f5;
border: 1px solid #ddd;
margin: 0 0 40px;
overflow: hidden;
padding: 10px;
}
@nickcernis
nickcernis / page_blog.php
Created October 14, 2014 11:46
Swap title tags from h2 to h1 on the blog index page in Genesis HTML5 themes.
<?php
//* Template Name: Blog
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action('genesis_entry_header', 'my_h1_blog_title');
function my_h1_blog_title () {
$title = apply_filters( 'genesis_post_title_text', get_the_title() );
@nickcernis
nickcernis / page_blog.php
Created October 14, 2014 11:54
Change titles from h2 to h1 tags for the blog index in XHTML Genesis themes.
<?php
//* Template Name: Blog
remove_action( 'genesis_post_title', 'genesis_do_post_title' );
add_action('genesis_post_title', 'my_h1_blog_title');
function my_h1_blog_title () {
$title = apply_filters( 'genesis_post_title_text', get_the_title() );
@nickcernis
nickcernis / page_blog.php
Created October 14, 2014 12:10
Change titles from h2 to h1 tags for the blog index in Genesis themes.
<?php
//* Template Name: Blog
if ( genesis_html5() ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action( 'genesis_entry_header', 'my_h1_blog_title' );
} else {
remove_action( 'genesis_post_title', 'genesis_do_post_title' );
@nickcernis
nickcernis / functions.php
Last active August 29, 2015 14:07
Ask IE not to use compatibility view (Note: may not work with caching plugins; use Apache/nginx to send headers instead)
<?php
// Don't copy the opening <?php tag above!
// Send headers to ask IE NOT to use compatibility mode
add_filter( 'wp_headers', 'genesis_keep_ie_modern' );
function genesis_keep_ie_modern( $headers ) {
if ( isset($_SERVER['HTTP_USER_AGENT']) && (strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false) ) {
$headers['X-UA-Compatible'] = 'IE=edge';
}
return $headers;
@nickcernis
nickcernis / Home Section 1 widget
Created October 16, 2014 11:47
How to modify the Parallax theme to add arrows on the homepage that autoscroll between sections
<!-- Add this to the bottom of your home section 1 widget in WordPress's Appearance > Widgets area-->
<a class="next-pane" data-goto=".home-section-2">&darr;</a>
@nickcernis
nickcernis / page_blog.php
Created October 17, 2014 19:00
A custom loop that displays one post on the Genesis Blog template
<?php
// Template Name: Blog
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'newspro_do_custom_loop' );
function newspro_do_custom_loop() {
global $paged;
@nickcernis
nickcernis / functions.php
Created November 26, 2014 13:13
Add galleries to homepage posts in Mindstream
// Add galleries to posts on the homepage if they have them
add_action( 'genesis_post_content', 'sp_gallery_in_excerpt', 1 );
function sp_gallery_in_excerpt() {
if ( !is_home() && !is_front_page() )
return;
if ( get_post_gallery() )
echo get_post_gallery();
}
add_action('genesis_after_header', 'wpsites_two_column_widgets');
/*** @author Brad Dalton* @example http://wpsites.net/* @copyright 2014 WP Sites */
function wpsites_two_column_widgets()
{
if (is_front_page() && is_active_sidebar('left-column') || is_active_sidebar('right-column')) {
echo '<div class="two-column-widgets">';
echo '<div class="wrap">';
genesis_widget_area('left-column',
array(