Forums

[resolved] Is get_option() Not For Templates? (3 posts)

  1. CharlesClarkson
    Member
    Posted 2 years ago #

    A customer was using qTranslate and referred me to this post where the site admin says:

    ... get_option is not supposed to be used in templates ...

    That's true when using qTranslate, but is it true in general?

    And if it is true, why is it true?

    TIA,

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Don't know why it would be bad...for example how else to do this:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('cat=1&posts_per_page='.get_option('posts_per_page').'&paged=' . $paged);
    ?>
  3. CharlesClarkson
    Member
    Posted 2 years ago #

    Thanks, Michael.

    I noticed that get_bloginfo() uses get_option() to retrieve some values. I assume the qTranslate author is using either the 'bloginfo_url' or 'bloginfo' filters and that is the source of his complaint.

    I appreciate the answer,

Topic Closed

This topic has been closed to new replies.

About this Topic