Skip to content

Instantly share code, notes, and snippets.

View ErikBernskiold's full-sized avatar

Erik Bernskiold ErikBernskiold

View GitHub Profile
@ErikBernskiold
ErikBernskiold / WordPress .htaccess
Created May 27, 2013 10:10
WordPress Default .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@ErikBernskiold
ErikBernskiold / WordPress: Plugin Textdomain
Last active December 20, 2015 01:19
Function for loading a textdomain for a WordPress plugin.
/**
* Add textdomain for plugin
*/
function xld_add_textdomain() {
load_plugin_textdomain( 'textdomain', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
add_action( 'plugins_loaded', 'xld_add_textdomain' ) );
@ErikBernskiold
ErikBernskiold / WordPress: Theme Textdomain
Last active December 20, 2015 01:19
Function for loading a textdomain into a WordPress theme.
/**
* Makes theme available for the built-in localization
**/
function xld_localization_support(){
$locale = get_locale();
load_theme_textdomain( 'textdomain', get_template_directory() . '/languages' );
$locale_file = get_template_directory() . "/languages/$locale.php";
@ErikBernskiold
ErikBernskiold / WordPress: Frontpage Only Content
Created July 27, 2013 17:14
Shows the content within the if-clause only on the frontpage.
<?php if ( is_front_page() ) : ?>
<h2>Hooray! This is the front page!</h2>
<p>Yep, we are on the frontpage, within this if-clause, we can do whatever we want. Pretty neat, eh?</p>
<?php endif; ?>
@ErikBernskiold
ErikBernskiold / gist:6317193
Created August 23, 2013 09:13
WordPress: List all hooks for a filter/action
function dump_hook( $tag, $hook ) {
ksort($hook);
echo "<pre>>>>>>\t$tag<br>";
foreach( $hook as $priority => $functions ) {
echo $priority;
foreach( $functions as $function )
@ErikBernskiold
ErikBernskiold / WordPress: Gravity Forms SASS Base
Created September 15, 2013 09:34
Basic custom styles, in SASS for Gravity Forms
/**
* Forms
*
* Styling for Gravity Forms
*/
.gform_body {
ul {
margin: 0;
padding: 0;
Swedish
nplurals=2; plural=(n != 1);
English
nplurals=2; plural=(n != 1);
List:
http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html?id=l10n/pluralforms
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@ErikBernskiold
ErikBernskiold / WP-VCS-.gitignore
Created July 8, 2014 15:08
.gitignore for version controlled WordPress
###################
# .gitignore
#
# We include all core files in the project repo and split passwords
# into ignored situational configurations so that we can store the wp-config.
###################
# WordPress #
#############
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
build: {
src: 'assets/js/main.js',
dest: 'assets/js/main.min.js'
}