[wp-trac] [WordPress Trac] #45258: Add the_theme_mod() For Displaying Theme Customizations

WordPress Trac noreply at wordpress.org
Fri Nov 2 09:28:24 UTC 2018


#45258: Add the_theme_mod() For Displaying Theme Customizations
-------------------------+------------------------
 Reporter:  Safaris in   |       Owner:  (none)
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  Themes       |     Version:
 Severity:  normal       |  Resolution:  duplicate
 Keywords:               |     Focuses:
-------------------------+------------------------
Changes (by ocean90):

 * status:  new => closed
 * component:  Customize => Themes
 * version:  5.0 =>
 * milestone:  Awaiting Review =>
 * resolution:   => duplicate


Old description:

> I figure, since a number of customizations are generally displayed, we
> could have a function that outputs these settings by key. It can echo the
> result of get_theme_mod()
>
> i.e
>
> function the_theme_mod( $name, $default = false, $language = null ){
>  if( is_null( $language ) ){
>     echo get_theme_mod( $name, $default );
>  } else {
>    __( get_theme_mod( $name, $default ), $language );
>  }
> }
>
> The last argument can be used to optionally pass a language domain for
> translations or formatting.

New description:

 I figure, since a number of customizations are generally displayed, we
 could have a function that outputs these settings by key. It can echo the
 result of get_theme_mod()

 i.e


 {{{
 function the_theme_mod( $name, $default = false, $language = null ){
  if( is_null( $language ) ){
     echo get_theme_mod( $name, $default );
  } else {
    __( get_theme_mod( $name, $default ), $language );
  }
 }
 }}}


 The last argument can be used to optionally pass a language domain for
 translations or formatting.

--

Comment:

 Hello @Safaris in, welcome to WordPress Trac!

 Thanks for your ticket. This was previously requested in #34387. I'm going
 to close the ticket as a duplicate and confirm the concerns mentioned in
 #34387 are still valid.

 P.S: You can't use `__( )` like in your example. Take a look at our
 [https://developer.wordpress.org/plugins/internationalization/ handbook]
 if you want to learn more about internationalization.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45258#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list