Posted in site bugs
9095
3:36 am, October 14, 2021
 

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";
        }

 

View Statistics
This Week
197
This Month
1198
This Year
2684

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
In this case my anchor this week becomes driving almost 2hrs outside of Atlanta to one of my favorite hard core gyms in the world.. MetroFlex aka The Dungeon. The gym owners turn the heat way up so it becomes a fun sweat box and the gym members just watch from afar and leave me alone. I happily drive myself long distances to find MY ANCHOR. Our anchor allows us to have balance, focus and be as productive as possible. And if you're in the middle of a heavy set and your headphones start to fall off your head, like mine did here.. well.. f*ck the headphones. Let em break and fall. You can always get a new pair, but the iron ain't ever gonna lift itself.
Unknown
Random CSS Property

animation-play-state

The animation-play-state CSS property sets whether an animation is running or paused.
animation-play-state css reference