I have included a third-party slider (Slider Pro) with which I have defined a couple of sliders that get displayed instead in the header instead of the built-in slider, based on the Parent-Page ID. It works fine for all pages and posts except for the home page.
This is the code I use to determine which slider to show:
function chose_slider(){
global $post;
switch (get_post_type()){
case 'portfolio':
break;
case 'page':
if($post->post_parent) { //Returns either the ID of the parent page or the page itself if it does not have a parent
$parent_ID = $post->post_parent;
} else {
$parent_ID = get_the_ID($post);
}
switch ($parent_ID) { //Returns the correct slider for each top-level page
case 1827: //About us
echo slider_pro(4);
break;
case 1681: //Climate Protection
echo slider_pro(5);
break;
(...)
}
case 'post':
echo slider_pro(1);
}
}
However, on the home-page get_post_type() always returns 'post' and get_the_ID() returns the ID of the latest blog post. Following that, the wrong slider is displayed.
Can you help me?














