Skip to content

Commit

Permalink
Merge pull request WPBuddy#280 from nipoez/develop
Browse files Browse the repository at this point in the history
Support for child theme homepage layout thumbnails.
  • Loading branch information
aschweigert committed Dec 12, 2014
2 parents f14a09d + df1ccf0 commit 8be147d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions homepages/homepage.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,21 @@ function largo_get_home_layouts() {
* @return string The public url of the image file to use for the given template's screenshot
*/
function largo_get_home_thumb($className) {
if (file_exists(get_template_directory() . '/homepages/assets/img/' . $className . '.png'))
return get_template_directory_uri() . '/homepages/assets/img/' . $className . '.png';
return get_template_directory_uri() . '/homepages/assets/img/no-thumb.png';
$home_thumb_url = '';
// Check the child theme for a homepage layout thumbnail
if (file_exists(get_stylesheet_directory() . '/homepages/assets/img/' . $className . '.png')) {
$home_thumb_url = get_stylesheet_directory_uri() . '/homepages/assets/img/' . $className . '.png';
}
// Check the Largo theme for a homepage layout thumbnail
elseif (file_exists(get_template_directory() . '/homepages/assets/img/' . $className . '.png')) {
$home_thumb_url = get_template_directory_uri() . '/homepages/assets/img/' . $className . '.png';
}
// Use the Largo theme default homepage layout thumbnail
else {
$home_thumb_url = get_template_directory_uri() . '/homepages/assets/img/no-thumb.png';
}

return $home_thumb_url;
}

/**
Expand Down

0 comments on commit 8be147d

Please sign in to comment.