WordPress.org

Ready to get started?Download WordPress

Forums

footer.php recursion (6 posts)

  1. mugger
    Member
    Posted 4 years ago #

    Why does footer.php include <?php wp_footer(); ?> call?

    To make a version of page.php which uses a modified footer file,
    with <?php get_footer(foot1.php); ?>, does the new foot.php also include call <?php wp_footer(foot1.php); ?>?

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Why does footer.php include <?php wp_footer(); ?> call?

    It acts as a hook for plugins and is considered an essential theme hook.

    does the new foot.php also include call <?php wp_footer(foot1.php); ?>?

    Yes.

  3. mugger
    Member
    Posted 4 years ago #

    Seems not to matter.
    Calling <?php get_footer(foot2.php); ?> displayed footer.php.
    Here's my page file:

    <?php
     /* Template Name: page(foot2) */
    get_header(); ?>
    <div id="content" class="" role="main" style="width:700px;padding:0 0 0 20px;">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    <!-- 		<h2><?php the_title(); ?></h2> -->
    		<!-- 	<div class="entry">   -->
    			<div style="width:740px;">
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    			</div>
    		</div>
    		<?php endwhile; endif; ?>
    	</div>
    <?php get_footer(foot2.php); ?>
    <br />

    and my foot2.php

    <?php  /* Template Name: foot2 */ ?>
    <div id="footer" role="contentinfo" style="width:720px; margin:0 auto; border-top:1px #ccc solid;">
    <span style="font-weight:bold;">WordPress modified by xxxxx.&nbsp;&nbsp;<a href="longurl">Contact Webmaster</a></span>
    &nbsp;&nbsp;<a href="anotherurl/blog/">blog</a>
    <br /><br />
    </div>
    </div>
    <?php /* "Just what do you think you're doing Dave?" */ ?>
    		<?php wp_footer(foot2.php); ?>
    </body></html>

    I'm okay editing page.php and footer.php, but not in letting more than one footer be selected.

  4. mugger
    Member
    Posted 4 years ago #

    Is no one willing to explain making different footers on different pages? I thought I followed the docs.

  5. nsathees
    Member
    Posted 4 years ago #

    use <? include (foot2.php) ?>

  6. lwallgren
    Member
    Posted 4 years ago #

    I manage to get alternate footers by this code. However the background-color won't change according to the css file. What is overriding this? I didn't know where else to post this. Anyone?

    `<?php if (is_page('21') ) : ?>

    <?
    include( TEMPLATEPATH . '/footer.php' );
    ?>

    <?php else : ?>

    <?
    include( TEMPLATEPATH . '/foot2.php' );
    ?>

    <?php endif; ?> `

    CSS:

    #footer{
    	width:100%;
    	height:300px;
    	background-color:#fff;
    	float:left;
    	margin:0px 0px 40px 0px;
    }
    
    #foot2{
    	width:100%;
    	height:200px;
    	background-color:#bedef5;
    	float:left;
    	margin:0px 0px 40px 0px;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.