Can you customize the format of the Tumblr message based on its tag?

Running a custom Tumblr theme that will use the regular Tumblr post-types (text, images, links, etc.).

I would also like to make a special type of message that will be displayed in my photo, but I do not want it to be changed, but I would like to show the photo in high resolution in full width of the subject (about 1140 pixels wide).

I read about {block: HighRes} {/ block: HighRes}, but it seems to be due to the fact that clicking on the image is 500px in the original.

Is there a way to disable this auto redistribution for these specific assigned photos? Maybe a way to change the behavior based on post tags? (for example, if it has the tag "#photography", a full resolution display - if not, go and resize to 500 pixels wide).

Here is a visual example of what I'm trying to do: http://i.imgur.com/23p09.jpg

+4
source share
1 answer

You can use {TagsAsClasses}

For example, for this tumblr markup :

 {block:Posts} <div class="entry {TagsAsClasses}"> Post Content </div> {/block:Posts} 

and 3 posts that have the following tags:

  • photo, photo-hi-res
  • photo, low resolution photo
  • photo, photo

Tumblr displays the following html markup :

 <div class="entry photo photo-hi-res"> Post Content </div> <div class="entry photo photo-low-res"> Post Content </div> <div class="entry photo photography"> Post Content </div> 

and this markup can be handled with a little css :

 /* common for photo posts */ .entry.photo {} /* `hi-res`-tag photo posts */ .entry.photo-hi-res {} /* `low-res`-tag photo posts */ .entry.photo-low-res { width: 500px; } /* `photography`-tag photo posts */ /* the rule you need */ .entry.photography { width: 900px; } .entry.photography img { width: 100%; } 
+7
source

Source: https://habr.com/ru/post/1380930/


All Articles