Skip to content

Instantly share code, notes, and snippets.

View jayseventwo's full-sized avatar

jayseventwo jayseventwo

View GitHub Profile
@jayseventwo
jayseventwo / WordPress - style login page
Created April 24, 2013 03:57
Enable styling of the WordPres login page. Add to custom.php in Roots theme.
function custom_login_css() {
echo '<link rel="stylesheet" type="text/css" href="'.get_stylesheet_directory_uri().'/assets/css/app.css" />';
}
add_action('login_head', 'custom_login_css');
@jayseventwo
jayseventwo / WordPress - Hide plugins from admin area
Last active December 16, 2015 14:29
Hide certain plugins from the plugins page in WordPress
function hideplugins() {
global $wp_list_table;
$hidearr = array('plugin-folder/plugin.php');
$myplugins = $wp_list_table->items;
foreach ($myplugins as $key => $val) {
if (in_array($key,$hidearr)) {
unset($wp_list_table->items[$key]);
}
}
}
@jayseventwo
jayseventwo / Add featured image to blog archives page
Created April 24, 2013 03:55
Add featured image to the search/blog archive results. Add to templates/content.php in Roots theme
@jayseventwo
jayseventwo / Add custom menus to WordPress
Created April 24, 2013 03:52
Example code shown in lib/init.php for Roots theme or you can add to custom/functions.php
register_nav_menus(array(
'primary_navigation' => __('Primary Navigation', 'roots'),
'header-menu' => __( 'Header Menu' ) ,
'footer-menu' => __( 'Footer Menu' )
));
@jayseventwo
jayseventwo / Roots theme - hide page header on home page
Created April 24, 2013 03:50
open templates/page-header.php and replace with:
<?php if( !is_front_page() ):?>
<div class="page-header">
<h1><?php echo roots_title(); ?></h1>
</div>
<?php endif;?>
@jayseventwo
jayseventwo / show-if-certain-category
Created April 24, 2013 03:49
Show/hide certain page elements depending on category (useful for custom post types).
<?php if ( 'portfolio' == get_post_type() ) { ?>
portfolio
<?php } else { ?>
blog
<?php } ?>
@jayseventwo
jayseventwo / shortcodes.php
Last active December 15, 2015 05:29
Add Bootstrap Twitter shortcodes dropdown to your page/post editor when using Roots Theme. Also adds shortcode ability to widgets. Add this custom.php.
/**
* --------------------------------------------------------------------------------------------------------------------------- Add shortcodes */
add_shortcode('row', 'j72_row' );
add_shortcode('span', 'j72_span' );
add_shortcode('span4', 'j72_span4' );
add_shortcode('span5', 'j72_span5' );
add_shortcode('span6', 'j72_span6' );
add_shortcode('well', 'j72_well' );
add_shortcode('button', 'j72_button');