Skip to content

Instantly share code, notes, and snippets.

View paaljoachim's full-sized avatar

Paal Joachim Romdahl paaljoachim

View GitHub Profile
@paaljoachim
paaljoachim / post meta
Created September 17, 2014 18:32
Customize the post meta function.
/* Customize the post meta function below the post AND remove it from category pages
http://wordpress.stackexchange.com/questions/50961/removing-post-meta-from-category-pages */
add_filter( 'genesis_post_meta', 'sp_post_meta_filter' );
function sp_post_meta_filter($post_meta) {
if ( !is_page() ) {
if (is_archive() ) $post_meta = '';
else $post_meta = '[post_categories before="Categories: "] [post_tags before="Tagged: "]';
return $post_meta;
}}
@paaljoachim
paaljoachim / movie-custom-post-type
Last active August 29, 2015 14:15
Movie custom post type
<?php //* Mind this opening PHP tag
/**
* Register Movie Type
*
* @author Ren Ventura <EngageWP.com> - with some adjustments by Paal Joachim
* @link http://www.engagewp.com/nested-loops-custom-wordpress-queries
*/
add_action( 'init', 'rv_movie_cpt' );
@paaljoachim
paaljoachim / archive-movie.php
Last active August 29, 2015 14:15
archive-movie
<?php
/**
* movie archive page
*
*/
//* Force full width content layout
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
//* Remove the breadcrumb navigation
@paaljoachim
paaljoachim / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@paaljoachim
paaljoachim / css_resources.md
Last active August 29, 2015 14:19 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@paaljoachim
paaljoachim / last-post-update.php
Last active August 29, 2015 14:27
Sometimes I will update a post and the following code snippets adds below the original date a message that says updated then the date I updated the post.
//* The following code was taken from: https://dl.dropboxusercontent.com/u/2503558/GenesisWP/code-snippets.html
//* and works only for child themes using the Genesis framework.
//*
//* Add last updated date to the post info in entry header
add_filter( 'genesis_post_info', 'sk_post_info_filter' );
function sk_post_info_filter($post_info) {
if (get_the_modified_time() != get_the_time()) {
$post_info = $post_info . '<br/>Last updated on: ' . the_modified_date('F j, Y', '', '', false);
}
@paaljoachim
paaljoachim / default-post-thumbnail.php
Created August 20, 2015 06:52
Define a post thumbnail with Genesis child themes.
//* Define a default post thumbnail
//* http://dreamwhisperdesigns.com/genesis-tutorials/genesis-default-thumbnails/
add_filter('genesis_get_image', 'default_image_fallback', 10, 2);
function default_image_fallback($output, $args) {
global $post;
if( $output || $args['size'] == 'full' )
return $output;
$thumbnail = CHILD_URL.'/images/WordPress-info150x150.jpg';
@paaljoachim
paaljoachim / remove-default-WP-widgets.php
Created August 20, 2015 07:05
The code snippet added to the functions.php file will remove the default WordPress widgets. I have commented the widgets I do not want to remove.
/* The below code removes all the default WordPress widgets. I commeted the ones I do not want to remove. */
// unregister all widgets
function unregister_default_widgets() {
unregister_widget('WP_Widget_Pages');
unregister_widget('WP_Widget_Calendar');
unregister_widget('WP_Widget_Archives');
unregister_widget('WP_Widget_Links');
unregister_widget('WP_Widget_Meta');
unregister_widget('WP_Widget_Search');
@paaljoachim
paaljoachim / global.js
Created August 24, 2015 09:49
Creating a sticky header.
// Adding code to create an effect on the header/nav on scroll
jQuery(function( $ ){
if( $( document ).scrollTop() > 0 ){
$( '.site-header' ).addClass( 'dark' );
}
// Add opacity class to site header
$( document ).on('scroll', function(){
@paaljoachim
paaljoachim / Another-file
Last active January 8, 2016 10:20
A test gist
Another file