2012-10-18 242 views
0

每當我通過wordpress或新的woocommerce頁面添加新頁面時,由於安裝woocommerce插件都會將側邊欄推到內容下的頁面底部。側邊欄出現在wordpress內容下

我不知道爲什麼會發生這種情況。請查看所附照片

enter image description here

這是代碼的樣子在我的主題側邊欄的CSS

/* Sidebar 
---------------------------------------- */ 
#sidebar { 
    float: Left; 
} 

    .widget { 
     background: url(images/box-tail.gif) repeat-x 50% 0%; 
     position: relative; 
     margin: 0 0 30px 0; 
     border: 1px solid #f0f0f0; 
     border-top: none; 
     border-radius: 4px; 
     -moz-border-radius: 4px; 
     -webkit-border-radius: 4px; 
    } 

     ul.children { 
      margin: 0 0 0 20px; 
     } 

    .widget-indent { 
     padding: 0 20px 19px 20px; 
    } 

.primary_content_wrap .widget { 
    padding: 0 19px 19px 19px; 
} 

.primary_content_wrap h3 { 
    padding: 0 0 21px 0; 
} 

.primary_content_wrap .widget #searchform { 
    width: 100%; 
} 

    .primary_content_wrap .widget #searchform input[type="text"] { 
     width: 123px; 
    } 

這是我的sidebar.php

<aside id="sidebar" class="grid_6 omega"> 
    <?php if (! dynamic_sidebar('Sidebar')) : ?> 

     <div id="sidebar-search" class="widget"> 
      <h3>Search</h3> 
      <?php get_search_form(); ?> <!-- outputs the default Wordpress search form--> 
     </div> 

     <div id="sidebar-nav" class="widget menu"> 
      <h3>Navigation</h3> 
      <?php wp_nav_menu(array('menu' => 'Sidebar Menu')); ?> <!-- editable within the Wordpress backend --> 
     </div> 

     <div id="sidebar-archives" class="widget"> 
      <h3>Archives</h3> 
      <ul> 
       <?php wp_get_archives('type=monthly'); ?> 
      </ul> 
     </div> 

     <div id="sidebar-meta" class="widget"> 
      <h3>Meta</h3> 
      <ul> 
       <?php wp_register(); ?> 
       <li><?php wp_loginout(); ?></li> 
       <?php wp_meta(); ?> 
      </ul> 
     </div> 

    <?php endif; ?> 
</aside><!--sidebar--> 

然後將此是我如何在每個頁面中調用側邊欄的方式

<?php get_sidebar(); ?> 

任何幫助將不勝感激。

UPDATE 外觀>小部件

enter image description here

+0

檢查您的外觀 - >小工具,看看有什麼。 – SMacFadyen

+0

我用外觀>小部件的圖像更新了我的問題,它在框中說這會出現在頁面的右側。 – HurkNburkS

+0

你能提供一個安裝的鏈接嗎?這對確定問題會有很大的幫助。 CSS級聯。在頁面的其他地方可能會出現問題。您發佈的代碼不足以確定問題或讓您知道如何解決問題。 – evandentremont

回答

1

您是否檢查過該頁面當前正在使用哪個模板?

的「 所有頁」名單上

點擊快速編輯從模板下拉菜單中選擇你的頁面不同的模板?

+0

這篇文章啓發我檢查頁面..我無法找到我的商店頁面,但我能夠重新創建..使用woocommerce簡碼..通過這樣做,它完全添加了我的側邊欄! 非常感謝幫助。 – HurkNburkS

0

確保添加到側邊欄的寬度,你的主要內容寬度小於你的頁面主體的寬度。這可以解釋爲什麼,即使使用「float:left」屬性,您的側邊欄也會在頁面的底部。

而且,爲什麼不包括在你的PHP條件下整個側邊欄代碼:

<?php if (! dynamic_sidebar('Sidebar')) : ?> 
<aside id="sidebar" class="grid_6 omega"> 
     <div id="sidebar-search" class="widget"> 
      <h3>Search</h3> 
      <?php get_search_form(); ?> <!-- outputs the default Wordpress search form--> 
     </div> 

     <div id="sidebar-nav" class="widget menu"> 
      <h3>Navigation</h3> 
      <?php wp_nav_menu(array('menu' => 'Sidebar Menu')); ?> <!-- editable within the Wordpress backend --> 
     </div> 

     <div id="sidebar-archives" class="widget"> 
      <h3>Archives</h3> 
      <ul> 
       <?php wp_get_archives('type=monthly'); ?> 
      </ul> 
     </div> 

     <div id="sidebar-meta" class="widget"> 
      <h3>Meta</h3> 
      <ul> 
       <?php wp_register(); ?> 
       <li><?php wp_loginout(); ?></li> 
       <?php wp_meta(); ?> 
      </ul> 
     </div> 
</aside><!--sidebar--> 
<?php endif; ?> 
+0

好的謝謝你的信息..上面的代碼使一切都瘋狂了..但它確實設法讓菜單右邊有它的一面仍然無法使用,但因爲它做了什麼,其餘的現場。 – HurkNburkS

+0

我想我會嘗試找到woocommerce購物車的寬度,並將其做得更小,以便菜單符合..只需要弄清楚...很多代碼可能很難找到。 – HurkNburkS

+0

您也可以重寫css屬性。你可以使用Firebug或類似的東西找到它,並在你自己的css中覆蓋塊的css屬性。 – VeZoul

0

你可以提供一個鏈接到您的安裝?這可能是您提供的代碼之外的問題,並且可能通過查看實時站點更容易解決。

0

您是否嘗試在側邊欄和左側內容中定義寬度值?讓你的左邊的內容也浮動(如果沒有)。例如

#sidebar{ 
    float:right; //much better to use float right if the sidebar will be placed at the right side of the page 
    width:100px; //define a smaller temporary value of the width for testing purposes 
} 

#left_content{ 
    float:left; 
    width:300px;  
} 

您可能會嘗試調整CSS並在瀏覽器中使用螢火蟲檢查html元素。 檢查http://getfirebug.com/

0

我認爲這很可能是非常簡單的事情。您使用的網格使得製作列非常容易。你的頁面模板會像這樣:

<?php get_header(); ?> 

<div class="container_12"> 

<div class="grid_6"> 
<--- main content here ---> 
</div> 

<?php get_sidebar(); ?> 

</div> 


<?php get_footer(); ?> 
0

當主要內容和側邊欄已分配給它們的尺寸不彼此相鄰或過多的保證金或填充適合,側邊欄會自動移動到下方的屏幕。這可能會導致問題