Forums

[resolved] Want main page footer to be different to other page footers (7 posts)

  1. deathwinger
    Member
    Posted 2 years ago #

    Hi, this is my website, http://www.mosaictt.com/PID

    I am using the constructor template and I have this floating video javascript code in the footer.

    I want the main page to be the only one to have that floating layer video to the bottom right of the web, but right now all the pages have it.
    I want only the main page to have it.

    How would this be possible?

    Thanks in advance.

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Use Conditional Tags such as is_home().

  3. jonimueller
    Member
    Posted 2 years ago #

    You could create a template called frontpage.php that will be your main page. Make sure it has this code at the top:

    <?php /*
    Template Name: Front
    */ ?>

    Then create another template called footerhome.php. Place your floating javascript code there.

    Return to your frontpage.php template file. At the bottom, instead of this:
    <?php get_footer(); ?>
    use this:
    <?php include (TEMPLATEPATH . '/footerhome.php'); ?>

    The frontpage.php file will load the footerhome.php file that contains your video code. The other template files will load the standard footer.php file.

    Then create a new Page that will contain your main page contents. Make sure that the Page Template selected is "Front Page Template". It should appear in the dropdown after you've uploaded it to your theme's directory.

    Now, in the WP dashboard, under Settings, Reading, make sure that under Front Page Displays... you check Static Page, and that the newly created Page is selected as what WordPress will display on the front page.

    HTH.

  4. deathwinger
    Member
    Posted 2 years ago #

    Doesn't seem to be working, here is a copy and paste of the code I have in my footer.php

    <?php
    /**
     * @package WordPress
     * @subpackage Constructor
     */
    ?>
    	<div id="footer">
    	    if  is_home() {
    <script>
    /* VARIABLES */
    var seconds_before_movie_is_removed=10;
    var location_of_skin="http://forums.creativecow.net/docs/answer_files/1/Clear_Skin_1";
    var location_of_skin="http://forums.creativecow.net/docs/answer_files/1/Clear_Skin_1";
    var location_of_flv="http://forums.creativecow.net/docs/answer_files/1/00089_001_12";
    var location_of_swf="http://forums.creativecow.net/docs/answer_files/1/FLVPlayer_Progressive.swf";
    var swf_width=320;
    var swf_height=180; 
    
    /* TO COUNT HOW MANY LOOPS OF THE MOVE IN FUNCTION HAVE RUN */
    var c=0; 
    
    function movein(){
    var botrightdiv=document.getElementById('bottomrightdiv');
    var rightpx=botrightdiv.style.right;
    var rightpx_num=parseFloat(rightpx);
    if(rightpx_num<0||c==0){
    /* ON THE FIRST PASS PUT THE MOVIE IN AND SET VARIABLES */
    if(c==0){
    write_movie();
    botrightdiv.style.width=swf_width+"px";
    botrightdiv.style.height=swf_height+"px";
    botrightdiv.style.right="-"+swf_width+"px";
    rightpx=botrightdiv.style.right;
    rightpx_num=parseFloat(rightpx);
    }
    botrightdiv.style.right=(rightpx_num+20)+"px";
    c=c+1;
    setTimeout("movein()",100);
    }else{
    setTimeout("moveout()",(seconds_before_movie_is_removed*8000));
    }
    }
    /* FUNCTION TO MOVE THE MOVIE OUT */
    function moveout(){
    document.getElementById('bottomrightdiv').style.innerHTML="";
    document.getElementById('bottomrightdiv').style.right="-100000px";
    }
    /* FUNCTION TO PLACE THE MOVIE IN THE DIV */
    function write_movie(){
    document.getElementById('bottomrightdiv').innerHTML="<object width='"+swf_width+"' height='"+swf_height+"'><param name='movie' value='"+location_of_swf+"' /><param name='WMODE' value='transparent' /><param name='FlashVars' value='&MM_ComponentVersion=1&skinName="+location_of_skin+"&streamName="+location_of_flv+"&autoPlay=true&autoRewind=false' /><embed src='"+location_of_swf+"' flashvars='&MM_ComponentVersion=1&skinName="+location_of_skin+"&streamName="+location_of_flv+"&autoPlay=true&autoRewind=false' width='"+swf_width+"' height='"+swf_height+"' WMODE='transparent' /></object>";
    }
    </script> 
    
    <!-- THIS IS AN IE HACK TO MAKE THE FIXED POSITIONING WORK -->
    <style type="text/css">
    #bottomrightdiv { position: absolute; right: 0px; bottom: 0px; }
    div > div#bottomrightdiv { position: fixed; }
    </style><!--[if gte IE 5.5]><![if lt IE 7]>
    <style type="text/css">
    div#bottomrightdiv {
    right: auto; bottom: auto;
    left: expression( ( 0 - bottomrightdiv.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
    top: expression( ( 0 - bottomrightdiv.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
    }
    </style>
    <![endif]><![endif]-->
    <!-- END IE HACK --> 
    
    </head>
    <body bgcolor="#00CC66" onload="movein();">
    Footage Courtesy of <a href='http://www.allbetsareoff.com/'>allbetsareoff.com</a><br \>
    Website created by I.T. it Ltd.
    <div style="position: fixed; bottom: 0px; right: 0px; width: 0px; height: 0px;" id="bottomrightdiv"></div>
    </body> 
    
    }  else {
    
    		<?php if ( function_exists('dynamic_sidebar')) { dynamic_sidebar('footer'); } ?>
        	<p class="clear copy">
            	<?php get_constructor_footer(); ?>
        	</p>
    	</div>
    </div>
    </div>
    <?php wp_footer(); ?>
    </body>
    </html>
    
    }
    ?>
  5. jonimueller
    Member
    Posted 2 years ago #

    Are you talking to me or Michael? That code looks all wrong because at the bottom of what is ostensibly the footer.php code you have a call to the footer (<?php wp_footer(); ?>), so it's looping over and over.

  6. deathwinger
    Member
    Posted 2 years ago #

    That post was directed to Micheal because I did not refresh and see your comments.

    However, I will try your suggestion and see if that helps.

  7. deathwinger
    Member
    Posted 2 years ago #

    Works perfectly. Thank you very much for this response :)

Topic Closed

This topic has been closed to new replies.

About this Topic