Skip to content

Instantly share code, notes, and snippets.

if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' ) {
// Windows
$content_dir = str_replace( '/', DIRECTORY_SEPARATOR, WP_CONTENT_DIR );
$content_url = str_replace( $content_dir, WP_CONTENT_URL, dirname(__FILE__) );
$content_url = str_replace( $content_dir, content_url(), dirname(__FILE__) );
$cmb_url = str_replace( DIRECTORY_SEPARATOR, '/', $content_url );
} else {
$cmb_url = str_replace(
array(WP_CONTENT_DIR, WP_PLUGIN_DIR),
@fovoc
fovoc / functions.php
Created January 14, 2015 16:06
Shoestrap 3 - move featured images in archives before titles
<?php
function move_up_featured_images() {
global $ss_blog;
remove_action( 'shoestrap_entry_meta', array( $ss_blog, 'featured_image' ) );
add_action( 'shoestrap_in_article_top', array( $ss_blog, 'featured_image' ) );
}
add_action('wp','move_up_featured_images');
@fovoc
fovoc / functions.php
Created December 9, 2014 12:12
Shoestrap 3 - custom layouts
<?php
function custom_layout() {
/* set conditionals */
if ( is_singular() ) {
global $ss_layout;
/* set layout */
$ss_layout->set_layout( 2 );
/* Shane tweaks - BB Press */
.bbp-meta.text-right {
padding-right:7px
}
img.avatar.avatar-80.photo {
margin-bottom:10px
}
#bbpress-forums .bbp-attachments ol li.bbp-atthumb {
@fovoc
fovoc / functions.php
Created November 21, 2014 11:40
Shoestrap 3 - display featured image of single posts into the extra header area
<?php
/*
* Display featured images in extra header area of individual posts
*/
function my_featured_image() {
global $ss_framework, $ss_settings;
$data = array();
a:190:{s:8:"last_tab";s:2:"22";s:12:"options_mode";s:8:"advanced";s:4:"logo";a:5:{s:3:"url";s:0:"";s:2:"id";s:0:"";s:6:"height";s:0:"";s:5:"width";s:0:"";s:9:"thumbnail";s:0:"";}s:7:"favicon";a:5:{s:3:"url";s:0:"";s:2:"id";s:0:"";s:6:"height";s:0:"";s:5:"width";s:0:"";s:9:"thumbnail";s:0:"";}s:10:"apple_icon";a:5:{s:3:"url";s:0:"";s:2:"id";s:0:"";s:6:"height";s:0:"";s:5:"width";s:0:"";s:9:"thumbnail";s:0:"";}s:16:"gradients_toggle";s:1:"0";s:19:"color_brand_primary";s:7:"#6d1ebc";s:19:"color_brand_success";s:7:"#5cb85c";s:19:"color_brand_warning";s:7:"#f0ad4e";s:18:"color_brand_danger";s:7:"#d9534f";s:16:"color_brand_info";s:7:"#5bc0de";s:7:"html_bg";a:7:{s:16:"background-color";s:7:"#ffffff";s:17:"background-repeat";s:0:"";s:15:"background-size";s:0:"";s:21:"background-attachment";s:0:"";s:19:"background-position";s:0:"";s:16:"background-image";s:0:"";s:5:"media";a:4:{s:2:"id";s:0:"";s:6:"height";s:0:"";s:5:"width";s:0:"";s:9:"thumbnail";s:0:"";}}s:7:"body_bg";a:7:{s:16:"background-color";s:7:"#ffffff";s:17:
<?php
function open_wrapper() {
echo '<div class="col-sm-8 col-sm-offset-2">';
}
function close_wrapper() {
echo '</div>';
}
<?php
function move_extra_header() {
global $ss_headers;
// remove the Extra Header
remove_action( 'shoestrap_pre_wrap', array( $ss_headers, 'branding' ), 3 );
// add it before the primary navigation
add_action( 'shoestrap_pre_top_bar', array( $ss_headers, 'branding' ), 1 );
<?php
function my_custom_pre_main() {
echo 'This content will be visible after the content div and before the main content.';
}
function only_in_single_posts() {
if ( is_single() ) {
add_action( 'shoestrap_pre_main', 'my_custom_pre_main' );
}
}
<?php
function replace_secondary_menu() {
global $ss_menus;
// remove secondary navbar as added in /framework/bootstrap/includes/class-Shoestrap_Menus.php#L22
remove_action( 'shoestrap_pre_wrap', array( $ss_menus, 'secondary_navbar' ) );
// add our new navbar on top of Jumbotron area
add_action( 'shoestrap_pre_wrap', 'my_secondary_navbar', 1 );
}
add_action( 'wp', 'replace_secondary_menu' );