如何删除<li>标记

时间:2015-10-20 03:37:31

标签: html wordpress content-management-system

我无法找到此页面的“实际”后端(http://www.drink-driving-lawyers.com.au/pleading-guilty-or-not-guilty),我可以删除<li><ul>标记,这些标记会使第一个段落成为项目符号。

  承认有罪或无罪的决定是您在酒后驾驶案件中做出的最重要的决定。如果捍卫饮料驾驶费以获得律师的所有信息,这一点非常重要。在页面的下方有许多防御酒后驾车费用。

我们使用Wordpress作为CMS,每当我通过WP Admin访问该页面的后端时,该部分都没有项目符号,并未包含在<ul><li>代码中。然而,当您检查源时,它显示为:

<ul class="postul">
<li class="first-child last-child">
<p>The decision to plead guilty or not guilty is the most important decision that you make in a drink driving case. It is very important if defending a drink driving charge to have all the information from your lawyer. Further down the page there are a number of defences to drink driving charges.</p>
<p>You have to weigh up the chance of winning a defence of your drink driving charges with the extra cost and the possibly worse penalty you may receive.</p>

我需要调整哪些文件才能删除这些<ul><li>代码?

1 个答案:

答案 0 :(得分:1)

客户端

您可以轻松地在public SQLiteDatabase getWritableDatabase() { synchronized (this) { return getDatabaseLocked(true); } } public SQLiteDatabase getReadableDatabase() { synchronized (this) { return getDatabaseLocked(false); } } private SQLiteDatabase getDatabaseLocked(boolean writable) { if (mDatabase != null) { if (!mDatabase.isOpen()) { // Darn! The user closed the database by calling mDatabase.close(). mDatabase = null; } else if (!writable || !mDatabase.isReadOnly()) { // The database is already open for business. return mDatabase; } } . . . . . . final int version = db.getVersion(); if (version != mNewVersion) { if (db.isReadOnly()) { throw new SQLiteException("Can't upgrade read-only database from version " + db.getVersion() + " to " + mNewVersion + ": " + mName); } db.beginTransaction(); try { if (version == 0) { onCreate(db); } else { if (version > mNewVersion) { onDowngrade(db, version, mNewVersion); } else { onUpgrade(db, version, mNewVersion); } } db.setVersion(mNewVersion); db.setTransactionSuccessful(); } finally { db.endTransaction(); } } onOpen(db); if (db.isReadOnly()) { Log.w(TAG, "Opened " + mName + " in read-only mode"); } mDatabase = db; return db; } finally { mIsInitializing = false; if (db != null && db != mDatabase) { db.close(); } } } (或header.php)中包含此位,并通过删除Appearance > Editor > footer.php来解决问题:

<li class="first-child last-child">

阅读评论,我必须很容易理解我想要做的事情。但是我们一行一行:

<script type="text/javascript">
$(document).ready(function(){
var myList = $(".postul > li > *").first(); //find the first element after li
$(myList).unwrap(); //remove what's containing it without removing itself
});
</script>

等到DOM为formatted to be JavaScript safe

$(document).ready(function()

我想要一个名为var myList = $(".postul > li > *").first(); 的变量。此变量表示(从*开头读取)= <{1}}下的,其中myList位于另一个具有li类的元素中。

星号 =任何元素(lipostul或其他什么!)

此外,正如<div>所述,仅返回具有该条件的ready结果(因此页面中的其他项目不会受到影响)。

换句话说,它说找到了这个:

<p>

最后:

first()

现在找到我的元素后,first它。这意味着:

  

从DOM中删除匹配元素集的父元素,   将匹配的元素留在原位。

然后,我们的示例代码将成为:

<element class="postul">
    <li>
        <something> <!-- I WANT THIS! --> 
        <something> <!-- and NOT this --> 
    </li>
</element>
<element class="postul">
    <li>
        <something> <!-- NOT this either --> 
    </li>
</element>

这应该导致你想要实现的目标。

服务器侧

很难说它究竟来自哪里(虽然没有访问你的后端),但它肯定会影响你的每一个帖子,因此它来自你的服务器端。这仅取决于您的模板以及帖子的结构,但您可以查看模板中的$(myList).unwrap(); 或任何其他与帖子相关的PHP页面。