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:
<?php | |
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.
Thanks to Bryan for the suggestion in the forum where he wrote.
Organization of your topics
Hi Sridhar,
I’m still loving your tutorial site.
You have so many tutorials, I was wondering if you have given thought to a different way of organizing them?
If I am looking for a tutorial under one specific theme, I know I can click on the tagged link under any specific post. It would be nice if I could go to one page where I could see all the one line titles to a specific theme or one line titles to group of themes in columns. If I am looking for ideas for a specific theme, all the titles are on one page for me to examine.
Just a thought.Thanks again for all your hard work
Bryan
This is terrific! Thanks for doing this and for turning it into a tutorial. But I have a few questions.
Looks like you also turned this request into a tutorial, which is awesome. But I don’t understand (for lack of knowing what else to call it) — the premise. what does “$themes” represent? Is it a category or a tag? Looks like maybe a post tag yes? So if we wanted to do this for ourselves we need to tag our posts, yes?
Next— the code here at the top is added to which “Page template”? Or do we need to create a new doc in our child theme?
Lastly, do we need to utilize part of the tutorial about Favorites (linked above) to implement this?