隐藏Tumblr页面上的标记帖子

时间:2015-08-20 21:51:15

标签: html css tumblr tumblr-themes

好的,所以这是交易。我已经在多个网站上搜索了大约一周,其中包括如何隐藏索引页面中的特定标记帖子。来自我的Tumblr博客的标记页面。为了方便起见,请记住我确实对html& amp; css,因为这是我在一年内制作的第四个Tumblr主题,随着时间的推移我变得越来越好。所以,为了不浪费你的时间,我已经多次尝试过这些方法:

    1. <div id="posts {TagAsClasses}"></div>
    2. <div class="posts {TagAsClasses}"></div>
    3. {block:Posts}
       {block:HasTags}{block:Tags}<span class="tagged-{URLSafeTag}">{/block:Tags}{/block:HasTags}
       (*post content would go here*)
       {block:HasTags}{block:Tags}</span>{/block:Tags}{/block:HasTags}
       {/block:Posts}

这些都没有奏效。最初我有一个id选择器用于我的帖子内容但是把它改成了一个类,因为每次我放入{TagAsClasses}它会搞乱整个页面并且发布div不再对应CSS。

当我尝试上课时,我的页面看起来完全一样,完全忽略了{TagAsClasses}。

当我尝试第三种方法时,我不得不将它用于CSS:

    .tagged-HIDDEN {
    {block:IndexPage}
    display:none !important;
    {/block:IndexPage}
    {block:TagPage}
    display:inline !important;
    {/block:TagPage}
    }

“HIDDEN”当然会是我为要隐藏的帖子添加的任何标记。当我这样做时,涉及“!important”(这是我从另一个博客那里得到的指示),当我到达一个有我想隐藏的帖子的页面时,我的博客甚至都不会加载(我使用分页)。当我拿出“!important”时,我的博客会加载,但标记的帖子会显示出来,只是CSS有点搞砸了。

我已经尝试了一切,我甚至试图改变

    <span class> to <span id>

我改变后

    <div id posts> to <div class>

因为我认为跨度会变得更强大并起作用,但是我最终得到了与我之前提到的“!important”相同的东西。

现在您已经看过我尝试的所有选项,这是我的博客的完整html / css:ℂħёℓ§εå ...............

<meta name="color:Background" content="#000000">
<meta name="color:Primary Color" content="#000000">
<meta name="color:Secondary Color" content="#000000">

<meta name="color:Tertiary Color" content="#000000">
<meta name="color:Quaternary Color" content="#000000">
<meta name="color:Quinary Color" content="#000000">

<meta name="font:Sidebar Text" content="" />
<meta name="font:Posts Text" content="" />

<meta name="text:Sidebar Width" content="" />
<meta name="text:Sidebar Title Size" content=""/>
<meta name="text:Sidebar Description" content="" />

<meta name="image:Sidebar" content="" />
<meta name="image:Background" content="" />





<style>
html {

    background: -webkit-linear-gradient(top,{color:Background},white);
    background-attachment: fixed;
}
body {

}

#content {
    margin: 10px 0px 10px 260px;
    width: 1020px;
}

#content blockquote {
    border-left: solid black 1px;
    margin: 0px;
    padding-left: 10px;
    max-width: 100%;

}

    img {
    border: 0;
    max-width: 100%;
}

#content #posts {
    background-color: rgba(255,255,255,0.7);
    width: 250px;
    padding: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
    margin-left: 10px;
    margin-right: 10px;

    {block:PermalinkPage}
    width: 800px;
    {/block:PermalinkPage}
}

#content #posts .title {
  font-size: 15px;
  font-family: {font:Posts Text};
  color: {color:Primary Color};
}

#content #posts .text {
  font-size: 10px;
  font-family: {font:Posts Text};
  color: {color:Tertiary Color};
  max-width: 100%;
}

#content #posts .container {
    float: left;
}

#content a {
    text-decoration: none;
    color:{color:Quinary Color};
}




#posts .date {
    margin-top: 40%;
    margin-left: 40%;
}

#sidebar {
    font-family: {font:Sidebar Text};
    width: {text:Sidebar Width}px;
    float: left;
    position: fixed;

}

#sidebar .title {
    font-size: 30px;
    text-align: center;
}

#sidebar .title a {
    text-decoration: none;
    color: {color:Primary Color};
}

#sidebar .title a:hover {
    color: {color:Quaternary Color};
}

#sidebar .image {
    width: 250px;
    height: auto;
    border-radius: 100%;
}

#sidebar .description {
    font-size: {text:Sidebar Description}px;
    text-align: center;
    color: {color:Secondary Color};
}
#sidebar .links {
    margin-top: 10px;
    text-align: center;
}

#sidebar .links a {
    text-decoration: none;
    color: {color:Tertiary Color};
}

#sidebar .links a:hover {
    color: {color:Quaternary Color};
}

#sidebar .navigation {

}

#sidebar .navigation a {
    text-decoration: none;
    color: {color:Quinary Color};
}

#like_button {
    float:right;
    opacity: 0;
    position: absolute;
    display: inline-block !important;
    vertical-align: middle;
    margin-left: 75px;
    top: 50%;
    transition: .2s ease-in-out; 
   -moz-transition: .2s ease-in-out; 
   -webkit-transition: .2s ease-in-out;
   }

#reblog_button {
    float:right;
    opacity: 0;
    position: absolute;
    display: inline-block !important;
    vertical-align: middle;
    margin-left: 155px;
    top: 50%;
    transition: .2s ease-in-out; 
    -moz-transition: .2s ease-in-out; 
    -webkit-transition: .2s ease-in-out;
    }

#notecount {
    float:right;
    opacity: 0;
    position: absolute;
    display: inline-block !important;
    left: 20%;
    top: 60%;
    transition: .2s ease-in-out; 
    -moz-transition: .2s ease-in-out; 
    -webkit-transition: .2s ease-in-out;
    font-family: {font:Sidebar Text};
    font-size: 10px;
}

#date {
    float:right;
    opacity: 0;
    position: absolute;
    display: inline-block !important;
    left: 60%;
    top: 60%;
    transition: .2s ease-in-out; 
    -moz-transition: .2s ease-in-out; 
    -webkit-transition: .2s ease-in-out;
    font-family: {font:Sidebar Text};
    font-size: 10px;
}

#posts .postnotes {
    font-family: {font:Posts Text};
}

#posts .info {
    background: rgba(255,255,255,0.8);
    opacity: 0;
    position: absolute;
    transition: .2s ease-in-out; 
    -moz-transition: .2s ease-in-out; 
    -webkit-transition: .2s ease-in-out;
    width: 250px;
    bottom: 14px;
    top: 10px;
}

#posts:hover .info {
    opacity: 1;
    {block:PermalinkPage}
    opacity: 0;
    {/block:PermalinkPage}
}

#posts:hover #like_button {
    opacity: 1;
}

#posts:hover #reblog_button {
    opacity: 1;
}

#posts:hover #notecount {
    opacity: 1;
}

#posts:hover #date {
    opacity: 1;
}



</style>

<script type="text/javascript"   src="http://static.tumblr.com/d0qlne1/DiAl6ekb7/jquery-1.4.2.min.js"></script>
<script src="http://static.tumblr.com/twte3d7/H8Glm663z/masonry.js"> </script>

<script type="text/javascript">
$(window).load(function () {
$('#content').masonry({
itemSelector : ".container",
},
function() { $('#content').masonry({ appendedContent: $(this) }); }
);
});
</script>
</head>


<body>

<div id="sidebar">
<img class="image" src="{image:Sidebar}" />
<div class="title"><a href="{blogURL}">{Title}</a></div>

<div class="description">{block:Description}{Description}{/block:Description}</div>


<div class="links">
{block:AskEnabled}<a href="/ask">Ask</a>{/block:AskEnabled}
{block:SubmissionsEnabled}<a href="/submit">Submit</a>{/block:SubmissionsEnabled}
{block:HasPages}{block:Pages}<a href="{url}">{Label}</a>{/block:Pages}{/block:HasPages}
<a href="/dashboard">Dashboard</a>
</div>

<div class="navigation">
{block:Pagination} 
{block:NextPage}<p id="page_nav"><a style="float:left" href="{NextPage}"  id="next">Previous</a>{/block:NextPage}
{block:PreviousPage}<a style="float:right" href="{PreviousPage}">Next</a></p>{/block:PreviousPage}
{/block:Pagination}
</div>
</div>


<div id="content">
{block:Posts}

<div id="posts">

<div class="info">
<div id="like_button">{likebutton}</div>
<div id="reblog_button">{reblogbutton color="grey"}</div>
<div id="notecount"><a href="{Permalink}#notes">{NoteCountWithLabel}</a>    </div> <div id="date"><a href="{Permalink}">{TimeAgo}</a></div>
</div>


<div class="container"> 
{block:Text}
{block:Title}<div class="title">{Title}</div>{/block:Title}
<div class="text">{Body}</div>

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>


{/block:Text}
</div> 

<div class="container"> 
{block:Quote}
<div class="title">"{Quote}"</div>
{block:Source}
<div class="text">{Source}</div>{/block:Source}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Quote}
</div>

<div class="container"> 
{block:Photo}
<img src="{PhotoURL-250}" />

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>

{/block:Photo}
</div>

<div class="container"> 
{block:Photoset}
{Photoset-250}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>

{/block:Photoset}
</div>

<div class="container"> 
{block:Video}
{Video-250}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Video}

</div>

<div class="container"> 
{block:Audio}
{AudioPlayer}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Audio}
</div>

<div class="container">     
{block:Answer}
<div class="title">{Question}</div>
<div class="text">~{Asker}</div>
<div class="text">{Answer}</div>

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Answer}
</div>

<div class="container"> 
{block:Chat}
{block:Title}{Title}{/block:Title}
{block:Lines}
{block:Label}<strong>{Label}</strong>{/block:Label}
{Line}
{/block:Lines}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Chat}
</div>

<div class="container"> 
{block:Link}
<a href="{URL}">{Name}</a>
{block:Description}{Description}{/block:Description}

<div class="postnotes">
{block:PostNotes}{PostNotes}{/block:PostNotes}
</div>
{/block:Link}
</div>

</div>

{/block:Posts}
</div>

</body>
</html>

忽略丢失的头部和!D0CTYPE html标签,它们在我的博客中,它们不会显示在这里。

1 个答案:

答案 0 :(得分:1)

这就是我所做的,基本上我使用tumblr的META标签来根据页面使用不同的CSS。

<head>
//Your head and CSS stuff here
{block:IndexPage}
<style>
.BLOCKME {display:none !important;}
</style>
{/block:IndexPage}
</head>

这会阻止标记为BLOCKME的所有帖子显示在主页上,您也可以使用{block:TagPage} {block:PermalinkPage}{block:SearchPage}

旁注以及您的帖子还必须包含class="{TagsAsClasses}"