How to add i18n to a plugin’s Twig template files?

Here’s how the Timber plugin handles this: $twig->addFunction( ‘__’, new Twig_SimpleFunction( ‘__’, function ( $text, $domain = ‘default’ ) { return __( $text, $domain ); } ) ); I’m guessing you’re doing something similar, in which case the reason these are being skipped is that you’re using a variable for the text domain. Have you … Read more

__() with sprintf returns untranslated string

The order of the functions being called is wrong. With this code: sprintf( __( ‘%s’, ‘my_text_domain’ ), $title ); You are trying to translate the string ‘%s’ in the domain ‘my_text_domain’. you are then replacing the translated string for ‘%s’ (which is ‘%s’), by the content of the variable $title. Therefore your code is similar … Read more

add spans and characters into paginate_links

The function paginate_links() can return “plain”, “list” and “array” (http://codex.wordpress.org/Function_Reference/paginate_links). Just define the type as array then you’ll be to display it as you want: <?php global $wp_query; $big = 999999999; // need an unlikely integer $paginate_links = paginate_links( array( ‘base’ => str_replace( $big, ‘%#%’, get_pagenum_link( $big ) ), ‘format’ => ‘?paged=%#%’, ‘current’ => max( … Read more

Multiple Permalinks for Same Post

The request parsing is handled in WP::parse_request(). After that, there’s a action hook parse_request which gives you the instance of the wp object. We assume that http://www.example.com/my-custom-post-type/this-is-a-cool-article is your permalink and http://www.example.com/mon-type-de-poste-personnalise/cest-un-article-sympa ends up in a 404. So the first thing to check in your callback should be, if the wp object is in a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)