Tutorials Organized by Child Themes

Posted on

I have created a page to display tutorials grouped by Genesis child themes here: sridharkatakam.com/by/child-theme.

A link to the same has been added under “Archive” menu item in the navigation.

Here’s the code in the Page template:

add_action( 'genesis_loop', 'sk_custom_loop' );
function sk_custom_loop() {

$themes = array(
'Agency Pro' => 'agency-pro',
'Agentpress Pro' => 'agentpress-pro',
'Altitude Pro' => 'altitude-pro',
'Ambiance Pro' => 'ambiance-pro',
'Aspire Pro' => 'aspire-pro',
'Atmosphere Pro' => 'atmosphere-pro',
'Beautiful Pro' => 'beautiful-pro',
'Brunch Pro' => 'brunch-pro',
'Cafe Pro' => 'cafe-pro',
'Centric Pro' => 'centric-pro',
'Daily Dish Pro' => 'daily-dish-pro',
'Digital Pro' => 'digital-pro',
'Digital Pro' => 'digital-pro',
'Dynamik' => 'dynamik',
'Education Pro' => 'education-pro',
'Eleven40 Pro' => 'eleven40-pro',
'Enterprise Pro' => 'enterprise-pro',
'Executive Pro' => 'executive-pro',
'Focus Pro' => 'focus-pro',
'Focus Pro' => 'focus-pro',
'Foodie Pro' => 'foodie-pro',
'Interior Pro' => 'interior-pro',
'Kickstart Pro' => 'kickstart-pro',
'Kickstart Pro' => 'kickstart-pro',
'Lifestyle Pro' => 'lifestyle-pro',
'Magazine Pro' => 'magazine-pro',
'Metro Pro' => 'metro-pro',
'Minimum Pro' => 'minimum-pro',
'Modern Portfolio Pro' => 'modern-portfolio-pro',
'Modern Studio Pro' => 'modern-studio-pro',
'News Pro' => 'news-pro',
'No Sidebar Pro' => 'no-sidebar-pro',
'Outreach Pro' => 'outreach-pro',
'Parallax Pro' => 'parallax-pro',
'Remobile Pro' => 'remobile-pro',
'Showcase Pro' => 'showcase-pro',
'Sixteen Nine Pro' => 'sixteen-nine-pro',
'Streamline Pro' => 'streamline-pro',
'Swank' => 'swank',
'The 411 Pro' => 'the-411-pro',
'Utility Pro' => 'utility-pro',
'Whitespace Pro' => 'whitespace-pro',
'Workstation Pro' => 'workstation-pro',
);

echo '<div id="grid" data-columns>';

foreach( $themes as $key => $value ) {

echo '<div class="theme">';
echo '<h1 class="theme-name"><a href="'. get_term_link( $value, 'post_tag' ) .'">' . $key . '</a></h1>';

$args = array( 'tag' => $value );

$query = new WP_Query( $args );

echo '<ul>';
while( $query->have_posts() ) {
$query->the_post();

echo '<li>';

// Featured image
// if ( $image = genesis_get_image( 'format=url&size=medium' ) ) {
// printf( '<a href="%s" rel="bookmark"><img src="%s" alt="%s" class="alignleft" /></a>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
// }

// Entry title link
echo '<a href="' . get_permalink() . '">'. get_the_title() .'</a>';

if ( is_user_logged_in() ) {
the_favorites_button();
} else {
if ( 1 == get_favorites_count() ) {
echo '<span class="favorite-count">Favorited by ' . get_favorites_count() . ' user';
} else {
echo '<span class="favorite-count">Favorited by ' . get_favorites_count() . ' users';
}
}

// Excerpt
// the_excerpt();

echo '</li>';
}
echo '</ul>';

// Uncomment the lines of code (not comments) below to display a link to custom taxonomy archive
/* Always check if it's an error before continuing. get_term_link() can be finicky sometimes */
// $theme_link = get_term_link( $value, 'post_tag' );

// if( is_wp_error( $theme_link ) ) {
// continue;
// }

/* We successfully got a link. Print it out. */
// echo '<p class="tag-archive-link"><a href="' . $theme_link . '" class="button">' . $key . ' tutorials archive</a></p>';

wp_reset_query();
echo '</div>';

} // end foreach
echo '</div>';

}

wp_enqueue_script( 'salvattore', get_stylesheet_directory_uri() . '/js/salvattore.min.js', '', '1.0.9', true );

genesis();

Salvattore is being used for the responsive masonry grid and Favorties plugin about which I wrote in the past here.