Hos SMSlånfinans kan du ta SMSlån gratis första gången med betalningsanmärkningar. Det kan rädda dig ur en tillfällig knipa och du slipper betala några avgifter.

  • WP Extra Template Tags 0.3

  • Release Date: August 25th, 2008
  • Requirements: Wordpress 2.5+
  • Licence: GNU
  • Price: FREE Download


Template tags is a really good thing i WordPress. Unfortunately there are some tags missing. I created a plugin to provide WordPress users with extra template tags. It can be used in themes or plugins.

To prevent future function collisions I’ve put an underscore before every template tag. The WordPress team might delvelop these template tags later. If some tag already exist don’t hesitate to leave a comment.

Category tags

Category ID ( category_ID() / get_category_ID() )

Displays or returns the numeric ID of the category a post belongs to. This tag must be used within The Loop.
<?php _category_ID(); ?>
<?php echo _get_category_ID(); ?>

Category Parent ID ( category_parent_ID() / get_parent_ID() )

Displays or returns the numeric parent ID of the category a post belongs to. This tag must be used within The Loop.
<?php _category_parent_ID(); ?>
<?php echo _get_category_parent_ID(); ?>

Category Slug ( category_slug() / get_category_slug() )

Displays or returns the category slug/nicename of the category a post belongs to. This tag must be used within The Loop.
<?php _category_slug(); ?>
<?php echo _get_category_slug(); ?>

Category Name ( category_name() / get_category_name() )

Displays or returns the name/title of the category a post belongs to. This tag must be used within The Loop.
<?php _category_name(); ?>
<?php echo _get_category_name(); ?>

Category Count ( category_count() / get_category_count() )

Displays or returns the number of posts within a category. It can be used with a post ID, post slug / nicename or empty used within The Loop.
<?php _category_count(); ?>
<?php _category_count(3); ?>
<?php _category_count('about'); ?>
<?php echo _get_category_count(); ?>
<?php echo _get_category_count(3); ?>
<?php echo _get_category_count('about'); ?>

Get Category Name By ID ( get_category_name_by_ID() )

Returns the name/title of the category ID.
<?php echo _get_category_name_by_ID(3); ?>

Get Category ID By Name ( get_category_ID_by_name() )

Returns the ID of the category slug/nicename.
<?php echo _get_category_ID_by_name('about'); ?>

User tags

User ID ( user_id() / get_user_id() )

Displays or returns the user ID of the logged in user.
<?php _user_id(); ?>
<?php echo _get_user_id(); ?>

User Name ( user_name() / get_user_name() )

Displays or returns the user name of the logged in user.
<?php _user_name(); ?>
<?php echo _get_user_name(); ?>

User Level ( user_level() / get_user_level() )

Displays or returns the user level of the logged in user.
<?php _user_level(); ?>
<?php echo _user_level(); ?>

Page tags ( get_ID_by_page_name() )

ID by Page Name

Displays or returns the page ID by page or post slug/nicename.
<?php echo _get_ID_by_page_name('about'); ?>

Name by Page ID ( get_name_by_ID () )

<?php echo _get_name_by_page_ID(3); ?>

Depth ( get_depth() )

Returns the depth of a page. It can be used with a page ID or empty used within The Loop.
<?php echo _get_depth(); ?>
<?php echo _get_depth(3); ?>

Is Child ( is_child() )

Returns true if the current page is a child. It can be used with a page ID or empty used within The Loop.
<?php if(_is_child()) { echo 'This is a child page'; } ?>
<?php if(_is_child(3)) { echo 'This is a child page'; } ?>

Is Grandchild ( is_grandchild() )

Returns true if the current page is a grandchild.
<?php if(_is_grandchild()) { echo 'This is a grandchild page'; } ?>

Posts tags

Max Pages ( max_pages() / get_max_pages() )

Displays or returns the max amount of pages per post. This tag must be used within The Loop.
<?php _max_pages(); ?>
<?php echo _get_max_pages(); ?>

Delete Post Link ( delete_post_link() )

Displays a link to delete current post or page for logged in administrators. Be careful!
<?php _delete_post_link(); ?>

Get The Content WITH Formatting ( get_the_content_with_formatting() )

Returns get_the_content() tag WITH formatting like the_content().
<?php echo _get_the_content_with_formatting(); ?>

Permalink tags

Parent Permalink ( parent_permalink() / get_parent_permalink() )

Displays or returns the parent permalink. This tag must be used within The Loop.
<?php _parent_permalink(); ?>
<?php echo _get_parent_permalink(); ?>

Permalink by Name ( permalink_by_name() / get_permalink_by_name() )

Displays or returns the permalink by page or post slug/nicename.
<?php _permalink_by_name('about'); ?>
<?php echo _get_permalink_by_name('about'); ?>



  • __category_count() and _get_category_count updated.


  • _is_child() tag created.
  • _is_grandchild() tag created.
  • _get_depth() tag created.


  • _the_content_with_formatting() tag created.
  • Fixed bug in _delete_post_link() tag


  • Plugin created
  1. 2012-04-18 - Xavier

    Hi, I just one to said, thanxs, I recently join in the world of wordpress and customization and found your Plugin so great for it. Also I did some improvement to the plug-in I want to share, please send me and email to reply you with the files, does are for the admin page. cheers!

  2. 2011-09-22 - wgstjf

    Is there anyway to get the total number of posts including child categories? Cheers, Will

  3. 2010-05-04 - wp-user-01

    Most, if not all, those category functions could be replaced by using some variation of the existing functions.

    get_terms uses caching, so would be a good place to start…. it can return IDs, Names or all taxonomy data.

    If you feel strongly about your functions and what they provide, post them here.

    If they’re liked, voted for and wanted, then you could go from there to submitting a Trac diff/patch …

  4. 2009-11-14 - Levani

    Thanks you very much!

  5. 2009-10-15 - Marc Shaw

    Hey, I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say GREAT blog!…..I”ll be checking in on a regularly now….Keep up the good work! :)

    - Marc Shaw

  6. 2009-09-13 - Levani

    Please add _delete_comment_link(); for comments, like _delete_post_link(); for posts. Thanks

  7. 2009-07-24 - Ron

    Absolute gold! Good work.

  8. 2009-04-10 - Steve

    Is there a way for Parent Categories to also include counts for all child categories?

  9. 2009-02-08 - Thiet ke website

    Thanks a lot for sharing this plugin.i love it’s functionality.

    have a good day

  10. 2009-01-31 - Andrew Wimmer

    Thanks for your work on this plugin. I would like to be able to get the depth of the child page as well as the name of the child page. Is this possible? Or something that you’re working on? Thanks!

  11. 2008-12-31 - TJ

    I love the plugin, I wanted to know if there was a quick way to get a total post count, MINUS one (or more separated by comma) categories?

    Thanks so much, keep up the good work!

  12. 2008-12-12 - kushlumba

    Thanks for the post, I have been having the same problems.

  13. 2008-12-11 - bartiz

    Thanks for your interesting article

  14. 2008-12-06 - perezstudios


    I must say that if I can get your plugin to work it would be great. I am new to all of this php stuff and was wondering, after I installed your plugin how do I use it? I dont see an easy way of displaying my category count next to my categories. Can you provide some documentation or some way to implement this stuff?

    Thanks a million!

  15. 2008-11-22 - KC

    I was trying whole night until I got your plugin, you save my life :D

  16. 2008-11-04 - Giovanni

    Thank you very much for your plugin! It was exactly what i needed! I’ve used a lot of the new template tags and they all work perfecty! Great work!

  17. 2008-10-19 - Tracey

    Thanks for the great plugin. It’s exactly what I needed but I am looking for help with one problem. Is there anyway I can get rid of the dashes that come up between words when I use the ‘category slug’ tag. Thanks.

  18. 2008-10-14 - PN

    _delete_post_link(); is great.

    I have questions:
    1. Can I set security level for this tag so only editors and higher can see it?
    2. After the post is deleted, I got an error 404. How can I redirect to the previous page or home page instead?



  19. 2008-10-07 - David

    Excellent plugin! My suggestions:

    1. Add template tags for tags (as in keyword tagging) – e.g., Tag Slug, Tag Name, Tag Count, etc.

    2. Add template tags to show RSS link for applicable Category, Tag and Search result

  20. 2008-09-25 - charlequin

    Hey, great plugin!

    I found a small problem in the 0.4 release, though: _plugin_by_name calls _get_page_name_by_ID() (causing the function to not work) when it should be calling _get_ID_by_page_name instead. Flipping that around fixes the problem.

  21. 2008-09-22 - Dgold

    Thanks for the update on category count! It works in my header nav. :)

  22. 2008-09-21 - jens

    I’ve fixed the issue for you. Simply add the ID or the post slug (nicename) within the function like this: _get_category_count('hello-world').
    Thanks for your suggestion!

  23. 2008-09-21 - Dgold

    Hi! Thanks for this! One problem in my testing. I want to use _get_category_count() in my theme (in my header.php actually!).

    Example, I have the category Poems. In my header menu I want to display “8 Poems”.

    I don’t want to use the normal template tag for listing categories from WordPress because it only allows me to display it like this: “Poems (8)”.

    My problem with the WP Extra Template Tags plugin use of _get_category_count() is that it gets the “count” from The Loop. I want to get the “count” for a specified category number (3) or category name (“Poems”).

  24. 2008-09-19 - Tara

    HI, Just wondered if this plugin can do what I am looking for. I want to be able to use wp list pages to display navigation in my header but I want intsead of page titles to be shown to use the title or slug. So I might have a navigation link which says “About” but the page title will say “Welcome to XXX”. Is there a way of doing this with your plugin please?

    Thanks for your help

  25. 2008-09-12 - jens

    During the latest upgrade the download information somehow got lost. I’ve fixed the download link now. Thank you for the report!

  26. 2008-09-12 - David Vrensk

    Wonderful, just what I was looking for! But I can’t download the plugin. The link has href=”". Am I missing something?

  27. 2008-09-06 - Ryan Paul

    1. Sorry I missed a word… in WordPress, you can use a ‘more’ tag… so you can get the Read More… function (like on my website homepage). A function that would determine whether the ‘more’ has been used, and if you are viewing the whole article would be good.

    2. is_depth detects the depth… a function a bit like the following…

    _is_related_in_ANY_way_to() or _is_related_in_ANY_way_to(‘page name’)

    Does this explain what I mean?

  28. 2008-09-06 - jens

    Ryan Paul
    1. I don’t understand what you mean here.

    2. A good suggestion. I’ve released 3 new tags with the latest version of the plugin. _get_depth(), _is_child() and _is_grandchild(). The first one returns the page depth and it’s unlimited. The other two is limited like the name says.

    Soon, I’ll make it possible to include name with the _is_child() and _is_grandchild(), like this: _is_child(‘subpage’).

    I’m planning to release _is_parent() and _is_grandparent() later on as well.

    Thanks for your suggestions!

  29. 2008-09-04 - Ryan Paul

    Hi there…

    a couple of functions I’d love to see here is…

    1. a function that determines whether a post has the tag… and it determines if you’re viewing the page AFTER clicking on read more.

    2. This plugin: http://www.schloebe.de/wordpress/is-subpage-of-plugin/ only works one level deep. Something similar that would go UNLIMITED levels deep would be EXCELLENT. There used to be an ‘is_child’ plugin out there that I can’t find anymore.

  30. 2008-09-02 - jens

    Tomas Kapler
    If you find functions that are already build in, tell me about them and I’ll remove them.

    If WordPress uses the function functionname() and I have a function called functionname() they will collide, that is what the underscore is for. The if function exists only checks if the function is already there which cannot be used in this case. If I’m wrong, write an example and I’ll have a look at it.

    baron & Chris SX
    Thank you!

  31. 2008-09-01 - Tomas Kapler

    it do not make much sense for me to make special functions for otherwise build-in functions or variables.
    And i think it would be much better to use if_function_exist than just underscored them

  32. 2008-08-28 - baron

    hi. Thanks for plugin



  33. 2008-08-27 - Chris SX

    Really usefull!
    I developed a few of them for my blogs too, but didnt think to compile them in 1 plugin


  1. 10款WordPress插件介绍 | dot KP 中文版
    WP Extra Template Tags review, discussions, does it work, and ratings on Loadwp.com | Loadwp.com
    Jackplug Web Design » Show Grandchild Subpages
    WP Extra Template Tags – Wordpress Plugin for Themes. Admin Hacks and Functions | web-templates.nu | Squico
    WP Extra Template Tags
    Recent Links Tagged With "tags" - JabberTags
    Using Wordpress as a CMS works like a charm | CasaDiRocco
    Все о Wordpress » Архив блога » Плагины для Wordpress (12.09.2008)
    WordPress Plugin Releases for 08/27 | Credise
    WP Plugin Archive » WP Extra Template Tags
    WP Extra Template Tags: 增加Wordpress模板标签的插件
    Rss VURSAKnoktacom » Blog Arşivi » Links for 2008-08-28 [del.icio.us]
    WP Extra Template Tags: 增加Wordpress模板标签的插件 | 帕兰映像
    WordPress Plugin Releases for 08/27 · Softonix.com
    Extra Template Tags : Des fonctions en plus pour vos thèmes Wordpres. | Geekeries.fr - Astuces Wordpress, Actualités High-Tech, Plugins Wordpress, Apple, Windows
    WordPress Plugin Releases for 08/27 | BlogBroker24-7
    WordPress Plugins Database » Plugin Details » WP Extra Template Tags
    » WP Extra Template Tags