Changing the default hero image based on the category name [not yet done]
This is more of a todo item, at the moment the hero image uses the same image for every post unless a hero is specified for each, i would also like to set the default image per category so if the post or code is in a category it loads that default but the hero can still override that image per post.
So if the category == "site bugs" it sets the hero image to site_bugs.png or something similar.
Hero Widget
This is generated by the function $page_content .= $class->hero_widget($t_uid = $class->uid, $t_class = $p2);
Well on further inspection i have already built in a per category hero image, so that is good, just need to add some more options here.
PHP
<?php /* rather than just returning blank, why not add a placeholder or default image here instead, depending on the class type.
code background for code items, not sure for content. */
if(!$show_home_hero_content) { // dont overwrite a linked hero image.
if($t_class == "code") {
// matrix style background.. ;)
$show_home_hero_content = true;
$hero_image_url = "https://i.imgur.com/hP23gMk.jpg";
}
if($t_class == "content") {
$show_home_hero_content = true;
$hero_image_url = "https://i.imgur.com/5czkBNv.jpg";
}
if( ($t_class == "content") && ($t_class_loaded->category == "rs3") ) { // default rs3 category background.
$show_home_hero_content = true;
$hero_image_url = "https://i.imgur.com/M2QR7bN.jpg";
}
} ?>
That was easier than i thought as i had already done the work it seems. Its funny how you write code and then forget about it, i should probably document it more.
PHP
if($t_class_loaded->category == "react") {
$show_home_hero_content = true;
$hero_image_url = "https://i.imgur.com/aff9ett.jpg";
}