I want to include a custom inline js on home page only. I havent set home page from reading section. I am using home.php file.
function print_my_inline_script() {
if (is_home() && wp_script_is( 'jquery', 'done' ) ) {
?>
<script type="text/javascript">
jQuery(document).ready(function($){
$('.carousel').carousel();
$('.item').hover(function(e){
$(this).find('.summary').stop().fadeTo('fast',1);
},function(){
$(this).find('.summary').stop().fadeOut('fast');
});
});
</script>
<?php
}
}
add_action( 'wp_footer', 'print_my_inline_script' );
This doesnt work. is_front_page() doesnt work either.
I have already done <?php wp_reset_query(); ?> after loop.
I have one more question. I know home.page overrides index.php and works as home page.
But I dont want my users to get confused when they change options in reading section.
I have found this,
update_option( 'page_on_front', $post->ID );
update_option( 'show_on_front', 'page' );
but it needs an ID and I dont have any page, so I dont have any id.
So, I need a way to set check if user is in home.php (home page) and since using home.php overrides the reading section options, any workarounds for that ?