title: Woocommerce wordpress functions.php - adding php to div
body: <p>I am trying to integrate woocommerce to a non woocommerce theme. It is going fine except for one problem. </p>
  
  <p>My theme has a div called block that hides the content then fades it in/adds padding. I want this to be in the woocommerce pages too.</p>
  
  <p>The div is like this</p>
  
  <pre><code>  &lt;div id="block" &lt;?php 
    if ($detect-&gt;isMobile()) {if($detect-&gt;isTablet()){
    /* Tab */
    if (get_field("search_override_header_position", "options") &amp;&amp; get_field("search_tablet_header_position", "options")) {echo 'data-header-position="'.get_field("search_tablet_header_position", "options").'"';} else {echo 'data-header-position="'.$tablet_header_position.'"';};
  } else {
    /* Mob */ }
    if (get_field("search_override_header_position", "options") &amp;&amp; get_field("search_mobile_header_position", "options")) {echo 'data-header-position="'.get_field("search_mobile_header_position", "options").'"';} else {echo 'data-header-position="'.$mobile_header_position.'"';};
  } else {
    /* Desc */
    if (get_field("search_override_header_position", "options") &amp;&amp; get_field("search_header_position", "options")) {echo 'data-header-position="'.get_field("search_header_position", "options").'"';} else {echo 'data-header-position="'.$header_position.'"';};
  } 
  ?&gt;&gt;&amp;nbsp;&lt;/div&gt;
  </code></pre>
  
  <p>Using this <a href="http://docs.woothemes.com/document/third-party-custom-theme-compatibility/" rel="nofollow">http://docs.woothemes.com/document/third-party-custom-theme-compatibility/</a> </p>
  
  <p>I tried to put this into my functions PHP and all I get is a white page and lots of syntax errors</p>
  
  <pre><code>remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
  remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
  
  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 '
  
      &lt;div id="block" &lt;?php 
        if ($detect-&gt;isMobile()) {if($detect-&gt;isTablet()){
        /* Tab */
        if (get_field("search_override_header_position", "options") &amp;&amp; get_field("search_tablet_header_position", "options")) {echo 'data-header-position="'.get_field("search_tablet_header_position", "options").'"';} else {echo 'data-header-position="'.$tablet_header_position.'"';};
      } else {
        /* Mob */ }
        if (get_field("search_override_header_position", "options") &amp;&amp; get_field("search_mobile_header_position", "options")) {echo 'data-header-position="'.get_field("search_mobile_header_position", "options").'"';} else {echo 'data-header-position="'.$mobile_header_position.'"';};
      } else {
        /* Desc */
        if (get_field("search_override_header_position", "options") &amp;&amp; get_field("search_header_position", "options")) {echo 'data-header-position="'.get_field("search_header_position", "options").'"';} else {echo 'data-header-position="'.$header_position.'"';};
      } 
      ?&gt;&gt;&amp;nbsp;&lt;/div&gt;&lt;section id="main"&gt;';
  }
  
  function my_theme_wrapper_end() {
    echo '&lt;/section&gt;';
  }
  </code></pre>