Skip to content

Instantly share code, notes, and snippets.

View ErikBernskiold's full-sized avatar

Erik Bernskiold ErikBernskiold

View GitHub Profile
@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 / 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: 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 .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>