[wp-hackers] Best way to allow slug rewrite of CPT via i18n
Tom Barrett
tcbarrett at gmail.com
Thu Nov 28 08:47:15 UTC 2013
Thank you!
*adds to list updates for next version*
// Sent by Nexus
On 26 Nov 2013 22:00, "Otto" <otto at ottodestruct.com> wrote:
> Three things:
>
> - What Nicholas said about sanitizing it as a title, so that your
> urls don't break
> - You'll probably want to use _x to define a context for this, to allow it
> to be a separate translation for this use of "glossary" from any others you
> might have elsewhere
> - You can't use a defined constant for the text domain, it needs to be a
> plain string
>
> So, like this:
>
> 'rewrite' => array( 'slug' => sanitize_title( _x( 'glossary', 'rewrite
> slug', 'wp-glossary' ) ) ),
>
> -Otto
>
>
> On Tue, Nov 26, 2013 at 3:52 PM, Nicholas Ciske <nl at thoughtrefinery.com>
> wrote:
> >
> > You probably want to run it through sanitize_title before you attempt to
> use it... lest a wily translator blow up your permalinks ;-)
> >
> > http://codex.wordpress.org/Function_Reference/sanitize_title
> > _________________________
> > Nick Ciske
> > http://thoughtrefinery.com/
> > @nciske
> >
> > On Nov 26, 2013, at 3:48 PM, Tom Barrett wrote:
> >
> >> Hello
> >>
> >> What is the best way to allow the of a custom post type to change via
> >> translation.
> >>
> >> I'm currently doing this:
> >> 'rewrite' => array( 'slug' => __( 'glossary', WPG_TEXTDOMAIN ) ),
> >>
> >> Is that good?
> >>
> >> Thanks!
> >> --
> >> http://www.tcbarrett.com | http://gplus.to/tcbarrett |
> >> http://twitter.com/tcbarrett
> >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list