Timber calling wordpress functions

linkaiyi
Follow

timber call wordpress build in functions

{{ function('wp_login_form', {object: args}) }}

set different language for different user

add_filter(‘locale’, ‘wpse27056_setLocale’);
function wpse27056_setLocale($locale) {
if ( is_admin() ) {
return ‘en_US’;
}

return $locale;
}

timber slice array

            <div class="col_half nobottommargin">
              <ul>
                {% for tag in tags|slice(0, tags|length // 2) %}
                <li><a class="btn btn-secondary" href="{{ tag.link }}" role="button">{{ tag.name }}</a></li>
                {% endfor %}
              </ul>
            </div>
            <div class="col_half nobottommargin col_last">
              <ul>
                {% for tag in tags|slice(tags|length // 2, tags|length-1) %}
                <li><a class="btn btn-secondary" href="{{ tag.link }}" role="button">{{ tag.name }}</a></li>
                {% endfor %}
              </ul>
            </div>
Object has 0 attachments

Was this article helpful?

This article is viewed 46 times!

Recent Viewed Articles

0 Comments

Leave a Comment

Support