Configure Post Comments and Date

Configure Post Comments and Date

Configure Post Comments & Date While writing a code for a Custom Blogger Template…

Price: 

Configure Post Comments & Date

While writing a code for a Custom Blogger Template there should be Cheat sheet of some xml codes to make workflow faster than fast.  

Syntax Code for Comments

Below the code to configure comments is provided but the styling is on you. Explanation of the code is also provided below. 



  
  
<b:if cond='data:post.numberOfComments gt 0 and data:jwidget.allBylineItems.comments'>
 <small>
 <data:post.numberOfComments/>
 </small> 
 </b:if>
 
 
Demo
 
 Preveiw:
 6
          

Explaination

  1. <b:if>: This is a conditional tag in Blogger's template language. It checks a specified condition and executes the contained content (inside the <b:if> block) if the condition is true.
  2. cond='data:post.numberOfComments gt 0 and data:jwidget.allBylineItems.comments': This is the condition being checked. It consists of two parts joined by the logical "and" operator (and). Let's break down each part:

    • data:post.numberOfComments gt 0: This part checks whether the number of comments on the current post (data:post.numberOfComments) is greater than 0. It's using the greater than (gt) operator.

    • data:jwidget.allBylineItems.comments: This part appears to be checking the presence of a widget or data related to comments in the byline items. Without more context, it's challenging to precisely explain this part.

  3. <small><data:post.numberOfComments/></small>: If the condition is true, the content inside the <b:if> block is executed. In this case, it outputs the number of comments for the current post wrapped in a <small> HTML tag. The value is obtained using the data:post.numberOfComments variable.
In summary, this code checks if the number of comments on the current post is greater than 0 and if a specific widget or data related to comments is present in the byline items. If both conditions are true, it displays the number of comments in a small HTML tag.


Syntax Code for Post Date


  Copy Your Code!
  
    
<b:if cond='data:jwidget.allBylineItems.timestamp'>
  <small>
    <span expr:data-date='data:post.date.iso8601'>
      <b:eval expr='data:jwidget.allBylineItems.timestamp.label ? data:post.date format data:jwidget.allBylineItems.timestamp.label : data:post.date'/>
    </span>
  </small>
</b:if>

  
Demo
 
 Preveiw:
 30 Dec, 2021
          

Explaination

Here's an explanation:
  1. <b:if cond='data:jwidget.allBylineItems.timestamp'>: This is a conditional statement that checks whether data:jwidget.allBylineItems.timestamp is defined or has a truthy value. If it evaluates to true, the content inside the <b:if> block will be executed.
  2. <span class='date-format' expr:data-date='data:post.date.iso8601'>: This begins a <span> HTML tag with a class attribute set to 'date-format'. It also has an expression (expr:data-date) that seems to set the data attribute data-date to the ISO 8601 formatted date of the current post (data:post.date.iso8601).
  3. <b:eval expr='data:jwidget.allBylineItems.timestamp.label ? data:post.date format data:jwidget.allBylineItems.timestamp.label : data:post.date'/>: This is an evaluation statement that uses the <b:eval> tag to conditionally format the date. It checks if data:jwidget.allBylineItems.timestamp.label is defined, and if true, it formats the date using the specified label. If not defined, it falls back to formatting the date using the default format (data:post.date).
  4. </span></small>: This closes the <span> and <small> tags.
In summary, this code checks if data:jwidget.allBylineItems.timestamp is defined. If true, it outputs a formatted date inside a <small> tag. The date formatting is conditional based on the presence of data:jwidget.allBylineItems.timestamp.label. If the label is defined, it uses that label for formatting; otherwise, it uses the default date format.

Increase font
Reset font
Previous Post Next Post
5 Comments
  • Jawad Ahmed
    Jawad Ahmed 18 November 2023 at 20:58

    Ask your Query Here

      • Jawad Ahmed
        Jawad Ahmed 18 November 2023 at 20:59

        OK

    • Jawad Ahmed
      Jawad Ahmed 18 November 2023 at 21:00

      Hello

    • FavoriteBan
      FavoriteBan 13 January 2024 at 13:47

      can you sell your register and login script?

        • Jawad Ahmed
          Jawad Ahmed 18 January 2024 at 20:58

          Coming soon...

      comment url
      newsletter

      Stay up to date with the latest news and relevant updates from us.


        Total Price: $0.00