• Hi,

    I am trying to edit functions.php per these instructions and I need some help in getting the syntax correct for adding these lines.

    add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
    add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);
    
    function my_theme_wrapper_start() {
      echo '<section id="main">';
    }
    
    function my_theme_wrapper_end() {
      echo '</section>';
    }

    The code from page.php is:

    <?php
    get_template_part('single', 'config');
    get_header();
    global $blogConf, $show, $single_content_type, $data, $isFrontendEditorPage, $isProfileOptionsPage, $isFavoritePage, $isDraftPage;
    if (have_posts ()) { the_post();
        $isFrontendEditorPage=isset($data['frontend_editor_page'])&&$data['frontend_editor_page']==$post->ID ? true:false;
        $isProfileOptionsPage=isset($data['profile_options_page'])&&$data['profile_options_page']==$post->ID ? true:false;
        $isFavoritePage      =isset($data['favorite_page'])       &&$data['favorite_page']       ==$post->ID ? true:false;
    	$isDraftPage      =isset($data['draft_page'])       &&$data['draft_page']       ==$post->ID ? true:false;
        $single_content_type=array('item','teaser');
        if($isFavoritePage || $isDraftPage){get_template_part('frontend','favorite');}
        else{get_template_part('content', 'single');}
    }
    get_footer();

    And from single.php is:

    <?php
    get_template_part('single', 'config');
    get_header();
    global $blogConf, $single_content_type;
    if (have_posts ()) { the_post();
        $single_content_type=array('item','meta');
        $format = get_post_format();
        $formatimg = $format == '' ? 'standart' : "format-$format";
        get_template_part('content', 'single');
    }
    get_footer(); ?>

    Many thanks in advance!

  • The topic ‘Editing functions.php to use my theme wrappers for WooCommerce’ is closed to new replies.