WordPress.org

Ready to get started?Download WordPress

Forums

Creating A footer2.php File (6 posts)

  1. alanchrishughes
    Member
    Posted 4 years ago #

    I've been working on a theme, but I realized I will not want my nice big 4 column footer widget area on all pages/templates. So I just saved a footer.php with the basic credits and info, and thought I could create a footerWidgets.php that I could just drop in <?php get_footerWidgets(); ?> on templates where I do want this widget area.

    But that is obviously missing some programing/php/functioning/stuff I don't know about. Is there any easy way of creating new site section php files that WordPress will recognize?

    Thanks.

  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    http://codex.wordpress.org/Function_Reference/get_footer

    get_footer('Widgets') and a file footer-Widgets.php

    or

    http://codex.wordpress.org/Include_Tags#Including_Any_Template

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

  3. alanchrishughes
    Member
    Posted 4 years ago #

    Thank you, I got it working but I'm still curious if there is a way to create a direct link to it like the way you do for get_footer or get_sidebar etc...

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    there is.... that was the first thing @alchymyth was referring to. You just have to name the file correctly....

    file name: footer-custom.php call: get_footer('custom')

    or

    file name: sidebar-custom.php call: get_sidebar('custom')

  5. alanchrishughes
    Member
    Posted 4 years ago #

    No I got that working fine and I understand that, I just mean something new and unique to itself that you can directly link to like <?php get_notepad(); ?>

  6. gwc_wd
    Member
    Posted 3 years ago #

    From my reading the footer-custom.php file is unique to a particular theme.

    I would like to add a small (and common) code snippet

    <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?>

    in a way that is not theme-dependent and upgrade proof.

    Is there code that could be include in custom-php.php which file works with all themes?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.