Skip to content

Instantly share code, notes, and snippets.

View themeblvd's full-sized avatar

Jason Bobich themeblvd

View GitHub Profile
<?php
/**
* For themes built prior to framework 2.5, this puts
* the HTML markup back to the way it was originally
* for various framework hooks that were modified in 2.5,
* which changed the structural markup setup of the theme.
*/
/*------------------------------------------------------------*/
/* Header
<?php
/**
* Find all instances of image URL strings within
* a text block.
*/
function themeblvd_get_images( $str ) {
$protocols = array('http://', 'https://');
$extentions = array('.gif', '.jpeg', '.jpg', '.png');
$images = array();
@themeblvd
themeblvd / disable-resonsive-side-menu.php
Created August 3, 2014 20:01
Disable the new responsive side menu
<?php
/**
* Remove "tb-side-menu" class from main navigation
*/
function my_primary_menu_args( $args ) {
$args['menu_class'] = str_replace( 'tb-side-menu', '', $args['menu_class'] );
$args['menu_class'] = themeblvd_remove_trailing_char( $args['menu_class'] );
return $args;
}
add_filter( 'themeblvd_primary_menu_args', 'my_primary_menu_args' );
@themeblvd
themeblvd / mobile-toggle-start-at-mobile.php
Created August 3, 2014 20:12
By default Jump Start responsive toggle (javascript) will be applied for tablets and below. This snippet will change that to mobile and below.
<?php
/**
* Kick in mobile menu starting at mobile(>768),
* instead of tablet (>993)
*/
function my_js_locals( $locals ) {
$locals['mobile_menu_viewport_max'] = '767';
return $locals;
}
add_filter( 'themeblvd_js_locals', 'my_js_locals' );
@themeblvd
themeblvd / comments-legacy.php
Last active August 29, 2015 14:04
This filter on to put $args passed into comment_form() in comments.php of the theme to match what was set prior to framework 2.5. This will make updating older themes easier, so we don't have to update their comment form styling.
<?php
/**
* Put comment args back the way they were prior to framework 2.5
*/
function theme_comment_form_args( $args, $commenter, $req, $aria_req ) {
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$args = array(
'fields' => array(
@themeblvd
themeblvd / blog-meta-legacy.php
Created August 6, 2014 21:20
If an older theme wasn't already using a custom action for meta, this will default back to the way it was before framework 2.5
<?php
/**
* If an older theme wasn't already using a custom
* action for meta, this will default back to the
* way it was before framework 2.5
*/
function theme_meta( $input ) {
// Separator
$sep = apply_filters( 'themeblvd_meta_separator', '<span class="sep"> / </span>' );
@themeblvd
themeblvd / thumb-options-legacy.php
Last active August 29, 2015 14:04
In framework 2.5, featured image size options were limited to show/hide. However, framework will still process options onto old content files (if theme has them). To put this all back in place, simply add the options back with the following.
<?php
/**
* In framework 2.5, featured image size options were
* limited to show/hide. However, framework will still
* process options onto old content files (if theme has them).
* To put this all back in place, simply add the options
* back with the following.
*/
function theme_featured_image_options( $options ) {
@themeblvd
themeblvd / post-options-legacy.php
Last active August 29, 2015 14:04
For older themes prior to framework 2.5, this will put the "Featured Image Display" option for single posts back how it was before. Theme framework will still handle this meta option as before.
<?php
/**
* For older themes prior to framework 2.5, this
* will put the "Featured Image Display" option
* for single posts back how it was before. Theme
* framework will still handle this meta option
* as before.
*/
function theme_post_meta( $setup ) {
@themeblvd
themeblvd / unhook-new-sub-meta-options.php
Created August 7, 2014 01:46
If old theme is already using a custom meta function, then we want to unhook the new options for sub meta.
<?php
/**
* Remove Content > Single > Sub Meta Information
*/
themeblvd_remove_option( 'content', 'single', 'single_sub_meta' );
/**
* Remove Sub Meta Information option from Post Options
*/
function theme_remove_sub_meta_post_option( $setup ) {
@themeblvd
themeblvd / sub-meta.php
Created August 8, 2014 02:14
Add sub meta to content.php (single post output) after the_content()
<?php if ( themeblvd_get_att( 'show_sub_meta' ) ) : ?>
<div class="sub-meta-wrapper">
<?php themeblvd_blog_sub_meta(); ?>
</div><!-- .sub-meta-wrapper (end) -->
<?php endif; ?>