コード例 #1
0
    /**
     * Themes per page field callback.
     *
     * @since  1.0.0
     * @access public
     * @return void
     */
    public function field_themes_per_page()
    {
        ?>

		<label>
			<input type="number" class="small-text" min="-1" name="thds_settings[themes_per_page]" value="<?php 
        echo esc_attr(thds_get_themes_per_page());
        ?>
" />
		</label>
	<?php 
    }
コード例 #2
0
ファイル: filters.php プロジェクト: grvrulz/theme-designer
/**
 * Filter on `pre_get_posts` to alter the main query on theme pages.
 *
 * @since  1.0.0
 * @access public
 * @param  object  $query
 * @return void
 */
function thds_pre_get_posts($query)
{
    if (!is_admin() && $query->is_main_query() && thds_is_archive()) {
        // Back-compat with TH system.
        if (get_option('th_sample_child_themes')) {
            $query->set('post__not_in', get_option('th_sample_child_themes'));
        }
        // Set the themes per page.
        $query->set('posts_per_page', thds_get_themes_per_page());
        $query->set('orderby', thds_get_themes_orderby());
        $query->set('order', thds_get_themes_order());
    }
}