Skip to content

Instantly share code, notes, and snippets.

View nicomollet's full-sized avatar

Nico Mollet nicomollet

View GitHub Profile
@nicomollet
nicomollet / wp-config-local.php
Last active August 29, 2015 14:06
WP config Local environment
<?php
//----- Environment -----//
define('WP_ENV', 'local');
//----- Database -----//
define('DB_NAME', '<dbname>');
define('DB_USER', '<dbuser>');
define('DB_PASSWORD', '<dbpassword>');
define('DB_HOST', '<dbhost>');
@nicomollet
nicomollet / addthis-customorder.html
Last active August 29, 2015 14:07
Addthis: sharing buttons with custom order
<div class="addthis_toolbox addthis_32x32_style addthis_default_style">
<a class="addthis_button_email"></a>
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_google_plusone_share"></a>
<a class="addthis_button_linkedin"></a>
<a class="addthis_button_facebook_like"></a>
<a class="addthis_button_tweet"></a>
@nicomollet
nicomollet / editor-styles.php
Last active August 29, 2015 14:07
Wordpress Editor Styles
<?php
function custom_tinymce_styles( $settings ) {
$style_formats_original = json_decode( $settings['style_formats'] );
$style_formats = array(
// Inline style
array(
'title' => 'Color Red',
'inline' => 'span',
@nicomollet
nicomollet / wp-config.php
Created October 19, 2014 15:44
Wordpress load config
<?php
// Load locale database configuration
require_once realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'wp-config-locale.php');
@nicomollet
nicomollet / breadcrumb-trail.php
Last active August 29, 2015 14:07
Wordpress Custom Breadcrumb Trail for StormBringer
<?php
// To customize the Breadcrumb, use this function in functions.php:
function custom_breadcrumb_trail_args(){
$args = array(
'separator' => '›', //Separator text
'before' => '' , // HTML displayed before
'after' => false, // HTML displayed after
'front_page' => true, // Display the homepage link
@nicomollet
nicomollet / breadcrumb-posttypearchive.php
Last active August 29, 2015 14:08
Wordpress Breadcrumb Trail for Custom Post Type
<?php
// Adds a custom breadcrumb item at position 1 (just after Home >)
function custom_breadcrumb_trail($trail ){
if( is_tax('custom_taxonomy') ){
$post_type_obj = get_post_type_object('custom_post_type');
$title = apply_filters('post_type_archive_title', $post_type_obj->labels->name );
$newtrail = array( '<li><a href="'.get_post_type_archive_link( 'custom_post_type' ).'">'.$title.'</a></li>' );
array_splice( $trail, 1, 0, $newtrail ); // splice in at position 1
@nicomollet
nicomollet / .gitignore
Last active August 29, 2015 14:08
WordPress gitignore
# ignore Wordpress files
/.htaccess
wp-content/uploads
sitemap.xml
sitemap.xml.gz
wp-config-locale.php
*.sql
php-errors.log
# ignore specific themes
@nicomollet
nicomollet / jetpack-sharing-text.php
Last active February 3, 2016 08:09
Jetpack remove sharing text
<?php
add_filter( 'jetpack_sharing_display_text', 'custom_jetpack_sharing_display_text', 10, 2 );
function custom_jetpack_sharing_display_text( $title ){
return '';
}
@nicomollet
nicomollet / infinite-scroll-orderby-meta.php
Last active May 30, 2016 16:32
Jetpack Infinite Scroll: Posts ordered by meta value
<?php
// Inspired by Isotrope code: https://gist.github.com/isotrope/1930f90518bdbfa074c3 and MCSF https://gist.github.com/mcsf/6c5cda9ee61acc8849c6
// Creates a query var called "tri"
function query_vars_tri( $vars ){
$vars[] = "tri";
return $vars;
}
add_filter( 'query_vars', 'query_vars_tri' );
@nicomollet
nicomollet / owlcarousel.php
Last active June 29, 2016 12:54
Owlcarousel: default settings for all owlcarousels
<?php
// Owlcarousel: default settings for all owlcarousels
function custom_owlcarousel_shortcode_atts($defaults){
$args = array(
'post_parent' => '' // ID of Page containing images, default is current page ID
'order' => 'ASC', // Order
'orderby' => 'ID', // Orderby
'image_size' => 'large', // Image size: thumbnail, medium, large, full
'exclude' => '' // Exclude images by listing their IDs, separate by comma