• Hi, I’ve never written code before but read a few posts and am trying to get the sidebar to appear in single post pages. Here’s the code that was in the single.php before I changed it:

    <?php
    
    /*
     * The Template for displaying all single posts.
     *
     * lambda framework v 1.0
     * by www.unitedthemes.com
     * since lambda framework v 1.0
     */
    
    global $lambda_meta_data;
    $meta_sidebar = $lambda_meta_data->get_the_value('sidebar');
    
    get_header();
    if($meta_sidebar != UT_THEME_INITIAL.'sidebar_none') {
    	st_before_content($columns='');
    
    } elseif($meta_sidebar == UT_THEME_INITIAL.'sidebar_none') {
    
    	st_before_content($columns='sixteen');
    
    }
    
    get_template_part( 'loop', 'single' );
    st_after_content();
    if($meta_sidebar) {
    	get_sidebar();
    } 
    
    get_footer();
    ?>

    And here is what I changed it to. Notice I removed “_none”

    <?php
    
    /*
     * The Template for displaying all single posts.
     *
     * lambda framework v 1.0
     * by www.unitedthemes.com
     * since lambda framework v 1.0
     */
    
    global $lambda_meta_data;
    $meta_sidebar = $lambda_meta_data->get_the_value('sidebar') after elseif section:
    
    get_header();
    if($meta_sidebar != UT_THEME_INITIAL.'sidebar_none') {
    	st_before_content($columns='');
    
    } elseif($meta_sidebar == UT_THEME_INITIAL.'sidebar') {
    
    	st_before_content($columns='sixteen');
    
    }
    
    get_template_part( 'loop', 'single' );
    st_after_content();
    if($meta_sidebar) {
    	get_sidebar();
    } 
    
    get_footer();
    ?>


    [Please use the code buttons NOT blockquote buttons for posting code]

    Did I do it correctly? What does the “if” “else if” part mean?

    Here’s my site: http://www.thehoundstoothblog.com

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sidebar single post php code’ is closed to new replies.