简体   繁体   English

Wordpress侧边栏在页面和帖子上的位置

[英]Wordpress sidebar positioning on page and post

for a few hours now I'm trying to solve a problem I encounter with the standard sidebar on my localy hosted wordpress site. 几个小时以来,我正在尝试解决在本地托管的wordpress网站上使用标准边栏遇到的问题。

The code of my sidebar is the following: CSS in the Customizer: 我的侧边栏代码如下:Customizer中的CSS:

 function mySlide(){ var x = document.getElementById("sidebar"); var y = document.getElementById("slider"); if(x.style.right === "0px"){ x.style.right = "-305px"; y.src = "arrow_left.png"; }else{ x.style.right = "0px"; y.src= "arrow_right.png"; } } 
 #sidebar{ background-color: #571e0b; padding: 0px 0px 0px 20px; position: fixed; top: 50px; right: -305px; height: 100%; width: 300px; transition: 0.5s; -webkit-transform: 0.5s; z-index: 2; } #slider { padding: 10px;; height: 50px; position: relative; left: -65px; background-color: #571e0b; border-radius: 0px 0px 0px 15px; } 
 <div id="sidebar"> <input alt="slider_button" id="slider" type="image" onclick="mySlide()" src="arrow_left.png"> </div> 

This kind of sidebar is positioned on posts and pages. 这种侧边栏位于帖子和页面上。 However, the difference between the right attribute of #sidebar on pages and on post is 75px and I can't find a reason to. 但是,页面和帖子上的#sidebar的right属性之间的区别是75px,我找不到原因。

The only clue I could find so far is, that it has something to do with pages being fullwidth and blogs being not. 到目前为止,我唯一能找到的线索是,这与页面全角而不是博客全角有关。

Other characteristics of my website: Theme: Themify Ultra v1.99 Plugins: Contact Form 7, Themify Portfolio Post, WP Super Cache 我网站的其他特征:主题:Themify Ultra v1.99插件:联系表格7,Themify Portfolio Post,WP Super Cache

What i tried so far: deleting everything on the affected pages. 到目前为止,我一直在尝试:删除受影响页面上的所有内容。 reinstalling the theme and plugins 重新安装主题和插件

Would marry someone for a solution... 愿意嫁给某人寻求解决方案...

Kind regards 亲切的问候

The Solution i found is a workaround with CSS. 我发现的解决方案是CSS的解决方法。 I set all pages to being not full width, and afterwards I used CSS to tell the container to resize. 我将所有页面设置为不全角,然后使用CSS告诉容器调整大小。

It's as simple as: 就像这样简单:

#content{
  width: 80%;    
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM