Plugin Directory

Changeset 1848493


Ignore:
Timestamp:
03/28/2018 12:30:05 PM (8 years ago)
Author:
themeblvd
Message:

1.0.5

Location:
theme-blvd-layouts-to-posts/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • theme-blvd-layouts-to-posts/trunk/readme.txt

    r1165432 r1848493  
    33Contributors: themeblvd
    44Tags: layout builder, builder, custom layouts, themeblvd, theme blvd, jason bobich
    5 Stable Tag: 1.0.4
     5Stable Tag: 1.0.5
     6Tested up to: 4.9
    67
    78This plugin extends the Theme Blvd Layout Builder so you can assign your custom templates to standard posts and custom post types.
     
    3536== Changelog ==
    3637
     38= 1.0.5 - 03/28/2018 =
     39
     40* Fixed: Password-protected posts display custom layout before password is entered (for Theme Blvd framework 2.7+ themes).
     41* Fixed: Styling of meta box was a bit wonky (for Theme Blvd framework 2.7+ themes).
     42
    3743= 1.0.4 - 05/21/2015 =
    3844
  • theme-blvd-layouts-to-posts/trunk/tb-layouts-to-posts.php

    r1165432 r1848493  
    33Plugin Name: Theme Blvd Layouts to Posts
    44Description: This plugin extends the Theme Blvd Layout Builder to allow you to assign your custom layouts to standard posts and custom post types.
    5 Version: 1.0.4
     5Version: 1.0.5
    66Author: Jason Bobich
    77Author URI: http://jasonbobich.com
     
    2626*/
    2727
    28 define( 'TB_LTP_PLUGIN_VERSION', '1.0.4' );
     28define( 'TB_LTP_PLUGIN_VERSION', '1.0.5' );
    2929define( 'TB_LTP_PLUGIN_DIR', dirname( __FILE__ ) );
    3030define( 'TB_LTP_PLUGIN_URI', plugins_url( '' , __FILE__ ) );
     
    3838
    3939    // Check to make sure Theme Blvd Framework is running
    40     if( ! defined( 'TB_FRAMEWORK_VERSION' ) || ! defined( 'TB_BUILDER_PLUGIN_VERSION' ) ) {
     40    if ( ! defined( 'TB_FRAMEWORK_VERSION' ) || ! defined( 'TB_BUILDER_PLUGIN_VERSION' ) ) {
    4141        add_action( 'admin_notices', 'themeblvd_ltp_notice' );
    4242        add_action( 'admin_init', 'themeblvd_ltp_disable_nag' );
     
    5656    // Also, if there was a custom layout assigned with our option,
    5757    // we need to redirect to the template_builder.php file.
    58     add_action( 'template_redirect', 'themeblvd_ltp_redirect' );
     58    add_action( 'template_include', 'themeblvd_ltp_redirect' );
    5959
    6060}
     
    125125    $url = admin_url( $pagenow );
    126126
    127     if( ! empty( $_SERVER['QUERY_STRING'] ) ) {
     127    if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
    128128        $url .= sprintf( '?%s&nag-ignore=%s', $_SERVER['QUERY_STRING'], 'tb-nag-'.$id );
    129129    } else {
     
    172172    $layouts = get_posts('post_type=tb_layout&orderby=title&order=ASC&numberposts=-1');
    173173
    174     if( $layouts ) {
     174    if ( $layouts ) {
    175175
    176176        $select = array( '' => '-- '.__( 'None', 'theme-blvd-layouts-to-posts' ).' --' );
     
    182182
    183183    $options = array(
    184         array(
    185             'id'    => '_tb_placeholder',
    186             'std'   => 1,
    187             'type'  => 'hidden'
    188         ),
    189184        array(
    190185            'id'        => '_tb_custom_layout',
     
    195190    );
    196191
    197     if ( version_compare(TB_FRAMEWORK_VERSION, '2.5.0', '<') ) {
    198         unset($options[0]);
    199     }
    200 
    201     // Start output
    202     echo '<div id="optionsframework" class="tb-meta-box side">';
     192    // Start output.
     193    // Note: #optionsframework ID needed prior to framewor 2.7.
     194    // Note: .tb-options-wrap class needed in framework 2.7+.
     195    echo '<div id="optionsframework" class="tb-meta-box tb-options-wrap side">';
    203196
    204197    // Display options form
     
    213206        echo $form[0];
    214207
    215     } else if( function_exists( 'optionsframework_fields' ) ) {
     208    } elseif ( function_exists( 'optionsframework_fields' ) ) {
    216209
    217210        // Options form for TB framework v2.0 - v2.1
     
    266259
    267260    // If any single post type
    268     if( is_single() ) {
     261    if ( is_single() ) {
    269262
    270263        // Get layout name if its been saved to this post.
     
    272265
    273266        // Only continue if a custom layout was selected
    274         if( $layout_name ) {
     267        if ( $layout_name ) {
    275268
    276269            if ( post_password_required() || ( 'private' == get_post_status() && ! current_user_can( 'edit_posts' ) ) ) {
     
    286279                $config['builder_post_id'] = themeblvd_post_id_by_name( $layout_name, 'tb_layout' ); // Needed in framework v2.2.1+
    287280
     281                $config['sidebar_layout'] = 'full_width';
     282
    288283                if ( $config['builder_post_id'] && version_compare(TB_FRAMEWORK_VERSION, '2.5.0', '<') ) {
    289284
     
    314309                    $config['sidebar_layout'] = $layout_settings['sidebar_layout'];
    315310
    316                     if( 'default' == $config['sidebar_layout'] ) {
     311                    if ( 'default' == $config['sidebar_layout'] ) {
    317312                        $config['sidebar_layout'] = themeblvd_get_option( 'sidebar_layout', null, apply_filters( 'themeblvd_default_sidebar_layout', 'sidebar_right' ) );
    318313                    }
     
    328323
    329324    }
     325
    330326    return $config;
    331327}
     
    342338 * @since 1.0.0
    343339 */
    344 function themeblvd_ltp_redirect( $config ) {
    345     // Include page template and exit if this is a
    346     // single post AND the global config says there
    347     // is a custom layout
    348     if( is_single() && themeblvd_config( 'builder' ) ) {
    349         include_once( locate_template( 'template_builder.php' ) );
    350         exit;
    351     }
    352 }
     340function themeblvd_ltp_redirect( $template ) {
     341
     342    // If post is password-protected, allow to
     343    // use single.php so that the password forms
     344    // shows instead of the custom layout.
     345    if ( post_password_required() ) {
     346
     347        return $template;
     348
     349    }
     350
     351    // If this is a single post with a template applied,
     352    // use the template_builder.php page template instead.
     353    if ( is_single() && themeblvd_config( 'builder' ) ) {
     354
     355        return locate_template( 'template_builder.php' );
     356
     357    }
     358
     359    return $template;
     360
     361}
Note: See TracChangeset for help on using the changeset viewer.