Skip to content

Instantly share code, notes, and snippets.

View schikulski's full-sized avatar

Simen Schikulski schikulski

View GitHub Profile
@schikulski
schikulski / wp_twocolumnwrap.php
Last active December 15, 2015 14:39
Wordpress: Two column wrap
<?php while( have_posts() ) : the_post(); //start of the loop ?>
<?php if( $wp_query->current_post%2 == 0 ) echo "\n".'<div class="twocolumnpostswrap">'."\n"; ?>
<?php // do post stuff here ?>
<?php if( $wp_query->current_post%2 == 1 || $wp_query->current_post == $wp_query->post_count-1 ) echo '</div> <!--/.twocolumnpostswrap-->'."\n"; ?>
<?php endwhile; //end of the loop ?>
@schikulski
schikulski / wp_featured_and_twocolumnwrap.php
Last active December 15, 2015 14:39
Wordpress: First as featured, then two column posts
@schikulski
schikulski / functions.php
Created April 13, 2013 09:20
Remove default WP widgets
// 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');
unregister_widget('WP_Widget_Text');
unregister_widget('WP_Widget_Categories');
@schikulski
schikulski / widgets.php
Created April 13, 2013 09:27
Wordress: ultra simple widget
/* ==========================================================================
Ultra simple wordpress widget
========================================================================== */
class BlogRoll extends WP_Widget {
public function __construct() {
parent::WP_Widget(false,'DISPLAY NAME','description=DISPLAY DESCRIPTION');
}
@schikulski
schikulski / content.php
Created April 13, 2013 09:42
Wordpress: thumbnail
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail('thumbnail');
} ?>
@schikulski
schikulski / dandelion.yml
Created May 10, 2013 09:51
dandelion.yml
scheme: ftp
host: ftp.example.com
username: example.com
password: password
path: hello/path
exclude: .gitignore dandelion.yml .DS_Store
@schikulski
schikulski / composer.json
Created June 27, 2013 08:10
Composer template
{
"name": "simenschi/project",
"description": "My Project",
"keywords": ["keyword"],
"require": {
"laravel/framework": "4.0.*"
},
"autoload": {
"classmap": [
"path/to/class"
@schikulski
schikulski / wp-config.php
Created August 7, 2013 11:45
wp-config.php
<?php
// ===================================================
// Load database info and local development parameters
// ===================================================
if ( file_exists( dirname( __FILE__ ) . '/wp-config-local.php' ) ) {
define( 'WP_LOCAL_DEV', true );
define('WP_DEBUG', true);
require ('wp-config-local.php');
} elseif (file_exists(dirname(__FILE__) . '/wp-config-playground.php')) {
@schikulski
schikulski / custom.php
Created December 6, 2013 09:04
Wordpress: simple shortcode
//[googlemaps]
function googlemaps_func( $atts ){
return '<div class="Flexible-container"><div id="hartzkart"></div></div>';
}
add_shortcode( 'googlemaps', 'googlemaps_func' );
@schikulski
schikulski / gist:8862236
Created February 7, 2014 13:00
Wordpress: query a singel page
<?php $page = new WP_Query("page_id=8"); while($page->have_posts()) : $page->the_post();?>
<?php endwhile; ?>