예제 #1
0
/**
 * Filter on `the_posts` for the theme archive. Moves sticky posts to the top of
 * the theme archive list.
 *
 * @since  1.0.0
 * @access public
 * @param  array  $posts
 * @param  object $query
 * @return array
 */
function thds_posts_sticky_filter($posts, $query)
{
    // Allow devs to filter when to show sticky themes.
    $show_stickies = apply_filters('thds_show_stickies', $query->is_main_query() && !is_admin() && thds_is_theme_archive() && !is_paged());
    // If we should show stickies, let's get them.
    if ($show_stickies) {
        remove_filter('the_posts', 'thds_posts_sticky_filter');
        $posts = thds_add_stickies($posts, thds_get_sticky_themes());
    }
    return $posts;
}
예제 #2
0
/**
 * Conditional tag to check if viewing any Theme Designer plugin page.
 *
 * @since  1.0.0
 * @access public
 * @param  mixed  $term
 * @return bool
 */
function thds_is_theme_designer()
{
    $is_thds = thds_is_theme_archive() || thds_is_single_theme() || thds_is_author() || thds_is_subject() || thds_is_feature();
    return apply_filters('thds_is_theme_designer', $is_thds);
}
예제 #3
0
/**
 * Filter the post class.
 *
 * @since  1.0.0
 * @access public
 * @param  array  $classes
 * @param  string $class
 * @param  int    $post_id
 * @return array
 */
function thds_post_class($classes, $class, $post_id)
{
    if (thds_is_theme($post_id) && thds_is_theme_archive() && thds_is_theme_sticky($post_id) && !is_paged()) {
        $classes[] = 'sticky';
    }
    return $classes;
}