Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8441751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:38:55+00:00 2026-06-10T08:38:55+00:00

Long time lurker, first time asker. I am currently writing a custom theme for

  • 0

Long time lurker, first time asker.

I am currently writing a custom theme for Tumblr blogs to embed a widget after every post, regardless of their type. This widget requires the post’s title, and if there is none, then it takes the blog’s title.

According to Tumblr, {Title} refers to the blog title. However, if we have a Text post or a Chat post, {Title} refers to the post title.

Here is my code:

var title;
if ('{PostType}' === 'text' || '{PostType}' === 'chat') 
    title = '{Title}';
else if ('{PostType}' === 'photo' || '{PostType}' === 'photoset' || '{PostType}' === 'audio' || '{PostType}' === 'video')
    title = '{PlaintextCaption}';
else if ('{PostType}' === 'quote')
    title = '{PlaintextQuote}';
else if ('{PostType}' === 'link')
    title = '{PlaintextName}';
else if ('{PostType}' === 'answer')
    title = '{PlaintextQuestion}';

if (title === '')
    title = '{Title}';

If I have a Photo post with no caption for example, then title will be correctly set to the blog title. But if I have a Text post with no title, then title will be set to [empty string] instead of the blog title.

So my question is: how can I get the blog title when I am inside of a Text or Chat post?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:38:56+00:00Added an answer on June 10, 2026 at 8:38 am

    What you can do is set the blog title as a variable before you enter into your {block:Posts}. So in your <head>, you can do this:

    var blogTitle = '{Title}';
    

    Then modify your code like this:

    var title;
    if ('{PostType}' === 'text' || '{PostType}' === 'chat') 
        title = blogTitle;
    else if ('{PostType}' === 'photo' || '{PostType}' === 'photoset' || '{PostType}' === 'audio' || '{PostType}' === 'video')
        title = '{PlaintextCaption}';
    else if ('{PostType}' === 'quote')
        title = '{PlaintextQuote}';
    else if ('{PostType}' === 'link')
        title = '{PlaintextName}';
    else if ('{PostType}' === 'answer')
        title = '{PlaintextQuestion}';
    
    if (title === '')
        title = '{Title}';
    

    Also, be careful, as {PostType} will never == 'photoset'. Photoset post types always come out as ‘photo’. What I usually do to counter that when making class names is this:

    class="type-{PostType}{block:Photoset}set{/block:Photoset}
    

    …and the output will be class="type-photoset".

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first post after being a long-time lurker - so please be
Long time browser, first time asker... Maybe you can help. I've searched and searched,
Long time lurker, first time poster. I have a page that can dynamically (with
Long time lurker, first time poster. I have found some good answers on here
First time poster, long time lurker :) I have a form setup that posts
Long time reader, first time poster asks: After many weeks of google and forum
Long time user, first time asker; very new to regular expressions. I'm a designer
Long time lurker, first time poster here. My question is: Using C# 2.0, is
long time reader, first time asker... I am making a music app which uses
Long time lurker, first time poster! Goal My ultimate goal is to make a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.