[wp-testers] getting a tag name w/o the loop

Brent Loertscher brent at loertscher.org
Thu Aug 9 14:20:08 GMT 2007


I wrote a plugin that adds, among other things, a single_tag_title() 
function to do what you want.  You can download it here: 
http://wordpress.org/extend/plugins/tag-functions/

Brent

Paul Stamatiou wrote:
> echo get_query_var('tag') works for me now, albeit formatted like the
> page slug. eg, "Web Dev" appears as "web-dev".
> 
> P
> 
> On 8/9/07, Paul Stamatiou <p at pstam.com> wrote:
>> I was looking at how the K2 theme does it, but I think it has its own system
>>
>>         } elseif (function_exists('is_tag') and is_tag()) {
>>                                 printf(__('Tag Archive for \'%s\'','k2_domain'), get_query_var('tag') );
>>
>> unless get_query_var() is part of WP that I'm not aware of?
>>
>> P
>>
>> On 8/9/07, DD32 <wordpress at dd32.id.au> wrote:
>>> Seems your right, It simply displays "Posts Tagged ''" for me too on the
>>> default theme.
>>>
>>> Looks like we're in need of a fair few new tag template functions and
>>> modifications to the current tag cloud.
>>>
>>> On Thu, 09 Aug 2007 18:56:08 +1000, Paul Stamatiou <p at pstam.com> wrote:
>>>
>>>> Thanks for the info. Unfortunately single_cat_tag() doesn't output
>>>> anything for me. As for the tag cloud, I had converted all of my
>>>> categories to tags (I wont run categories anymore) and just wanted to
>>>> exclude the 'uncategorized' tag from the cloud. The uncategorized tag
>>>> also 404s so I have no idea what is even uncategorized anymore.
>>>>
>>>> This is the top of my theloop.php, fairly similar to the code you posted:
>>>>
>>>> <?php if(have_posts()){
>>>>       $post = $posts[0];
>>>>       if(!is_single() && !is_home() or is_paged()){?>
>>>>       <div class="pagetitle">
>>>>               <h2>
>>>>
>>>>               <?php if (is_tag()) { ?>
>>>>               Posts tagged '<?php single_cat_title(); ?>'
>>>>
>>>>               <?php } elseif (is_day()) { ?>
>>>>               Archive for <?php the_time('F jS, Y'); ?>
>>>>
>>>>
>>>> On 8/9/07, DD32 <wordpress at dd32.id.au> wrote:
>>>>> On Thu, 09 Aug 2007 17:59:40 +1000, Paul Stamatiou <p at pstam.com> wrote:
>>>>>
>>>>>> Hi, I just co'd trunk, converted my categories to tags and am
>>>>>> converting my theme to support tags. I'm trying to find out how to get
>>>>>> a tag name without it being in the loop.
>>>>>>
>>>>>> For example, on a page like http://paulstamatiou.com/tags/news/, I
>>>>>> would have "posts in the <tagname> tag". I have gone through
>>>>>> category-template.php and tried several tag functions without luck. Is
>>>>>> this possible without needing to be in the loop. Basically I'm trying
>>>>>> to find a replacement for what I used to use:
>>>>>>
>>>>>>  if (is_category()) { ?>
>>>>>> Posts in the '<?php echo single_cat_title(); ?>' category
>>>>> You'd still use that, Sounds stupid, but seems thats the way its done,
>>>>>  From the default theme: archive.php
>>>>>   <?php /* If this is a category archive */ if (is_category()) { ?>
>>>>>         <h2 class="pagetitle">Archive for the &#8216;<?php
>>>>> single_cat_title();
>>>>> ?>&#8217; Category</h2>
>>>>>    <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
>>>>>         <h2 class="pagetitle">Posts Tagged &#8216;<?php
>>>>> single_cat_title();
>>>>> ?>&#8217;</h2>
>>>>>
>>>>>> Also, slightly unrelated, I can't seem to get
>>>>>> wp_tag_cloud('exclude=uncategorized') to exclude 'uncategorized'.
>>>>> I think it excludes by ID rather than by name.., But looking at it, it
>>>>> doesnt seem it actually references to exclude anywhere anyway, So you
>>>>> cant
>>>>> exclude it.
>>>>> What were you hoping to do here? Exclude the tag 'uncategorized' from
>>>>> showing up? excluding tags on posts in the category 'uncategorized'?
>>>>> --
>>>>> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>>>>> _______________________________________________
>>>>> wp-testers mailing list
>>>>> wp-testers at lists.automattic.com
>>>>> http://lists.automattic.com/mailman/listinfo/wp-testers
>>>>>
>>>>
>>>
>>>
>>> --
>>> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>>> _______________________________________________
>>> wp-testers mailing list
>>> wp-testers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-testers
>>>
>>
>> --
>> Paul Stamatiou
>> Computational Media
>> Georgia Tech in Atlanta, GA
>>
>> PaulStamatiou.com
>>
> 
> 


-- 
Brent Loertscher
brent at loertscher.org

There are 10 kinds of people: those who understand binary and those who 
don't.


More information about the wp-testers mailing list