WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Conditional Tags Trouble (2 posts)

  1. Misiur
    Member
    Posted 4 years ago #

    Hi there. I've got quite big trouble, becouse i've don't have much time. I use Javascript only on main page. I thought that i'll need PHP Server tag, but i saw in codex conditional tags.

    I'm working at http://misiur.com/immo

    I've wrote:

    <?php if(is_home && is_front_page)
    		{?>
    		<script type="text/javascript">
    				window.onload = function()
    				{
    					Load();
    				}
    				function Load()
    				{
    					var z = 0;
    					var q = document.getElementById('body');
    					for(var i=0; i<q.childNodes.length; i++)
    					{
    						if(q.childNodes[i].tagName == 'DIV')
    						{
    							z += q.childNodes[i].offsetHeight;
    						}
    					}
    					var spl = document.getElementById('spl_b');
    					var c = document.getElementById('w_mid');
    					var f = document.getElementById('footer');
    					var h = c.offsetHeight - 210;
    					q.style.height = z+"px";
    					spl.style.height = h+"px";
    					c.style.bottom = (h-58)+"px";
    					f.style.bottom = (h-58)+"px";
    				}
    		</script>
    		<?php }?>

    But the code is turned on, even on subpages. What is wrong? Help me as fast as You can.

  2. Misiur
    Member
    Posted 4 years ago #

    Solved. I forgot that the are functions so

    if(is_home() && is_front_page())

    is correct.

Topic Closed

This topic has been closed to new replies.

About this Topic