• Resolved santon

    (@santon)


    Hello.

    The problem is that functionality of Template Tags is very limited. So I often need to enchance this functionality. But I can’t do this because they OUTPUT their data to the generated document. But I need to PROCESS this data, and then output. I need to implement logic based on the values of template tags.

    Simple example. I can display the number of comments by the following code:
    comments_number('No comments yet', 'One comment', '% comments' );

    The problem is that in Russian language I need 4 forms of this message (not 3) with more complex dependence on the number of comments:
    0: Нет комментариев
    1: Один комментарий
    2: 2 комментария

    4: 4 комментария
    5: 5 комментариев

    20: 20 комментариев
    21: 21 комментарий

    Other example: I do not want link to the comments when there is no comments. But the comments_popup_link(”, ‘1’, ‘%’); still output link with empty text to the document when there is no comments.

    And so on…

    THE QUESTION IS: How to get value of the tag instead of printing it to the document?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi

    The comment functions are in wp-includes/comment.php and wp-includes/comment-template.php The higher level functions such as comments_number() use routines in these files to assemble their output.

    You can use the core functionality of these lower level routines and build code around them to output as you need it.

    Thread Starter santon

    (@santon)

    Thank you.

    But what is the simple way of finding low-level routines for each high-level template tag function?

    It will be good to add references to these routines to the ?See also? sections of the template tags reference info.

    Thread Starter santon

    (@santon)

    Excellent!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to get value of Template Tag?’ is closed to new replies.