[theme-reviewers] Ticket #8055: Need help.

Konstantin Obenland konstantin at obenland.it
Thu Jun 7 06:02:44 UTC 2012


The problem is that the output is not filterable in its entirety, and Plugins can't modify it.

The requirement is pretty clear on this: "wp_title(): Themes are required to modify output via filter (wp_title)"

So no, the way Twenty Eleven and countless other Themes do it is not correct, as frumph pointed out.
The example Cais gave earlier is great, as is Chip's on StackExchange.

Konstantin

On 07.06.2012, at 07:26, Gazpo Themes wrote:

> I am still confused, most of the recently accepted themes are using following code. I have used exactly same but theme reviewer is not accepting mine. What's the problem with it?
> 
> <title><?php
>     global $page, $paged;
>     wp_title( '|', true, 'right' );
>     bloginfo( 'name' );
> 
>     $site_description = get_bloginfo( 'description', 'display' );
>     if ( $site_description && ( is_home() || is_front_page() ) )
>         echo " | $site_description";
> 
>     if ( $paged >= 2 || $page >= 2 )
>         echo ' | ' . sprintf( __( 'Page %s', 'silverorchid' ), max( $paged, $page ) );
> 
>     ?></title>
> 
> Thanks.
> Sami.
> 
> 
> 
> 
> On Thu, Jun 7, 2012 at 3:11 AM, Edward Caissie <edward.caissie at gmail.com> wrote:
> Yes, there is some confusion here ...
> 
> 1. The use of the template tag `wp_title` is expected; but,
> 2. `wp_title` is expected to be use "correctly" as well.
> 
> Essentially, after varied discussions and input from several people, it was decided the correct / best practice method of using the template tag was to initially use the standard parameters then filter any "decorative" text, etc. into it afterward. The example in TwentyEleven works but could be improved upon to maintain the extensibility of the `wp_title` template tag.
> 
> As an example from Desk Mess Mirrored, which generates a very similar output to TwentyEleven (and TwentyTen) see the following code:
> 
> Use `<?php wp_title( '|', true, 'right' ); ?>` in the header.php template; and,
> 
> Use something similar to the following as the filtered function:
> 
> `<?php
> /**
>          * Use as filter input
>          *
>          * @param   string $old_title - default title text
>          * @param   string $sep - separator character
>          * @param   string $sep_location - left|right - separator placement in relationship to title
>          *
>          * @return  string - new title text
>          */
>         function dmm_wp_title( $old_title, $sep, $sep_location ) {
>             global $page, $paged;
>             /** Set initial title text */
>             $dmm_title_text = $old_title . get_bloginfo( 'name' );
>             /** Add wrapping spaces to separator character */
>             $sep = ' ' . $sep . ' ';
> 
>             /** Add the blog description (tagline) for the home/front page */
>             $site_tagline = get_bloginfo( 'description', 'display' );
>             if ( $site_tagline && ( is_home() || is_front_page() ) )
>                 $dmm_title_text .= "$sep$site_tagline";
> 
>             /** Add a page number if necessary */
> 
>             if ( $paged >= 2 || $page >= 2 )
>                 $dmm_title_text .= $sep . sprintf( __( 'Page %s', 'desk-mess-mirrored' ), max( $paged, $page ) );
> 
>             return $dmm_title_text;
>         }
>     add_filter( 'wp_title', 'dmm_wp_title', 10, 3 );
> ?>`
> 
> Again, this is only a (working) example, and it is not a definitive requirement that themes do this explicitly; but, it will make plugin authors much happier and your end-users as well, especially those that use SEO plugins which typically hook into the `wp_title` template tag.
> 
> Hope that makes some sense of the issue ...
> 
> 
> Cais.
> 
> 
> 
> On Wed, Jun 6, 2012 at 6:39 PM, Kirk Wight <kwight at kwight.ca> wrote:
> I think the confusion is in terminology. There are both a wp_title filter and a wp_title template tag; the requirement refers to the template tag which, if taken as-is from Twenty Eleven, should be fine.
> 
> 
> On 6 June 2012 16:08, Philip M. Hofer (Frumph) <philip at frumph.net> wrote:
> This one is new to me, the reference is here:
>  
> http://codex.wordpress.org/Theme_Review#Required_Hooks_and_Navigation
>  
> apply_filters(‘wp_title is found in wp-includes/general-template.php
>  
> It determines what the title is supposed to output, however it doesn’t do everything that people want it to, in most cases it doesn’t output the bloginfo appropriately on the home page that is specific for the theme.
>  
> It’s not that the codex is wrong at being a requirement, it’s more so that the current standards do not have enough documentation and core automatic themes are not utilizing the filter appropriately.
>  
> Example twentyeleven theme:
>  
> <title><?php
>     /*
>      * Print the <title> tag based on what is being viewed.
>      */
>     global $page, $paged;
>  
>     wp_title( '|', true, 'right' );
>  
>     // Add the blog name.
>     bloginfo( 'name' );
>  
>     // Add the blog description for the home/front page.
>     $site_description = get_bloginfo( 'description', 'display' );
>     if ( $site_description && ( is_home() || is_front_page() ) )
>         echo " | $site_description";
>  
>     // Add a page number if necessary:
>     if ( $paged >= 2 || $page >= 2 )
>         echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );
>  
>     ?></title>
>  
> This could actually be written as such:
>  
> add_filter(‘wp_title’, ‘twentyeleven_wp_title’);
>  
> function twentyeleven_wp_title($title) {
> global $wp_query, $paged, $page;
>     // add the blog name.
>     $title .= get_bloginfo(‘name’);
>     // Add the blog description for the home/front page.
>     $site_description = get_bloginfo( 'description', 'display' );
>     if ( $site_description && ( is_home() || is_front_page() ) )
>         $title .= " | $site_description";
>     // add a page number if necessary
>     // Add a page number if necessary:
>     if ( $paged >= 2 || $page >= 2 )
>         $title .= ' | ' . _x( 'Page %s', 'twentyeleven' ), max( $paged, $page ) ;
>     return $title;
> }
>  
> ^  little unsure of the _x( part and I’m doing this from memory.
>  
> But the biggest issue probably is lack of documentation to make that a requirement and people in the know not using it.
>  
> However, as you can see.   It *should* be done this way.
>  
> So the end result would be:
>  
> <title><?php wp_title( ‘|’, true, ‘right’); ?></title>
>  
> ^^ Now, the problem will be the output.    Someone else want to chime in on if this is correct?
>  
> - Phil
>  
> From: Gazpo Themes
> Sent: Wednesday, June 06, 2012 12:52 PM
> To: theme-reviewers at lists.wordpress.org
> Subject: [theme-reviewers] Ticket #8055: Need help.
>  
> Hello,
> I need help about my theme ticket (http://themes.trac.wordpress.org/ticket/8055)
> 
> The theme reviewer has suggested: 'Themes must use wp_title filter.'
> I have used the wp_title from the twenty eleven theme, and I can see that it works fine. Can someone tell me what's wrong with it?
> 
> Also about the header banner, it is by default linked to the local site where it will be installed. I really can't see where the problem is. 
> 
> Can someone please tell me about above issues, I will highly appreciate.
> 
> Thanks.
> Sami.
> 
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> 
> 
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> 
> 
> 
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> 
> 
> 
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> 
> 
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20120607/060e57ad/attachment.htm>


More information about the theme-reviewers mailing list