[英]Disable Wordpress auto <p> tag for specific input element only
I know I can prevent Wordpress from adding <p>
tags entirely. 我知道我可以阻止Wordpress完全添加
<p>
标签。 However, this is not an option as I have to deal with an entire post archive which counts on these tags, and I am not going back in time to fix every post manually.
但是,这不是一个选择,因为我必须处理依赖这些标签的整个帖子存档,并且我不会及时退回以手动修复每个帖子。
So my question is, how can I disable the auto <p>
tag for one page or even one element only? 所以我的问题是,如何禁用一页甚至一个元素的自动
<p>
标记? Specifically, I am using the CSS code .jumpsection:focus + #section-nav-menu {visibility: visible;}
for the HTML below: 具体来说,我将CSS代码
.jumpsection:focus + #section-nav-menu {visibility: visible;}
用于以下HTML:
<div id="section-nav">
<input type="text" value="GO TO SECTION" class="jumpsection"><p></p><!-- Grrr...Wordpress :( -->
<div id="section-nav-menu">
<ul class="contain">
<li class="section-nav-item"><a href="#s1">SECTION 1</a></li>
<li class="section-nav-item"><a href="#s2">SECTION 2</a></li>
<li class="section-nav-item"><a href="#s3">SECTION 3</a></li>
<li class="section-nav-item"><a href="#s4">SECTION 4</a></li>
</ul>
</div>
</div>
In other words, if I click on the input "GO TO SECTION", the section-nav-menu changes from visibility: hidden;
换句话说,如果我单击输入“转到部分”,则nav菜单的部分将从
visibility: hidden;
更改为visibility: hidden;
to visibility: visible;
visibility: visible;
which worked before I turned the auto <p>
tag back on. 在我重新打开自动
<p>
标记之前,这种方法已经奏效。 But as you can see in the HTML, Wordpress adds <p></p>
after the input element, which to my big frustration breaks the functionality of :focus
. 但是,正如您在HTML中看到的那样,Wordpress在input元素之后添加了
<p></p>
,这令我大为沮丧,这破坏了:focus
的功能。
If temporarily disabling the auto tags is not possible, any workaround for this specific problem (getting this pure CSS on-click dropdown to work) is also very appreciated!! 如果暂时不能禁用自动标记,那么也非常感谢您解决此特定问题的任何解决方法(使此纯CSS单击下拉菜单正常工作)!
You can use the ~
selector. 您可以使用
~
选择器。 Like this: 像这样:
.jumpsection:focus ~ #section-nav-menu {
visibility: visible;
}
You may be interested in this little plugin . 您可能对此小插件感兴趣。
Don't Muck My Markup 不要渣My我的标记
Here's the official description : 这是官方说明 :
Don't Muck My Markup lets you disable all auto-generated HTML markup from your posts and pages on a page-by-page basis.
别乱糟糟我的标记允许您逐页禁用帖子和页面中所有自动生成的HTML标记。
In a nutshell: 简而言之:
It adds a very simple box to the editor page that allows you to turn off the automatic mark up that the WordPress engine inserts. 它在编辑器页面上添加了一个非常简单的框 ,该框允许您关闭 WordPress引擎插入的自动标记 。
The options include 选项包括
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.