Skip to content
Catch Themes Logo

Catch Themes

Premium Responsive WordPress Themes with advanced functionality and awesome support. Simple, Clean and Lightweight Responsive WordPress Themes

  • Home
  • FSE Pro Plugin
  • Themes
  • Features
  • Hosting
  • Support
  • Blog
  • My Account

Adding Login/Logout Links to Footer

Support Forum Catch Flames

Tagged: footer, Link, login

  • This topic has 6 replies, 2 voices, and was last updated 9 years, 4 months ago by Mahesh.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • February 10, 2016 at 3:25 am #85053
    andrewf90
    Member

    Hi,

    I was wondering how I might add the login/logout php script so that it falls in the second footer widget column in line with the rest of the links in that column?

    I tried stuffing the following script in the footer.php file just to see where it ends up, but no luck. It ends up in its own container or space in the footer.

    Any ideas?

    Thanks 😛

    <?php if (is_user_logged_in()) : ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>">logout | </a>
    <?php else : ?> <a href="<?php echo wp_login_url(get_permalink()); ?>">login | </a>
    <?php endif;?>
    February 10, 2016 at 12:49 pm #85073
    Mahesh
    Participant

    Hi @andrewf90,

    You need to create a child theme for this. You can find more details on creating a child theme HERE. Then your child theme’s functions.php add the following code.

    function catchflames_child_adjust_footer_two_widget(){
    	//Footer Two Sidebar
    	register_sidebar( array(
    		'name' => __( 'Footer Area Two', 'catch-flames' ),
    		'id' => 'sidebar-3',
    		'description' => __( 'An optional widget area for your site footer', 'catch-flames' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		//'after_widget' => "</aside>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    }
    
    add_action( 'init', 'catchflames_child_adjust_footer_two_widget' );

    Then create a file in you child theme’s folder and name it sidebar-footer.php and the following codes:

    <?php
    /**
     * The Footer widget areas.
     *
     * @package Catch Themes
     * @subpackage Catch Flames
     * @since Catch Flames 1.0
     */
    ?>
    
    <?php
    	/* The footer widget area is triggered if any of the areas
    	 * have widgets. So let's check that first.
    	 *
    	 * If none of the sidebars have widgets, then let's bail early.
    	 */
    	if ( ! is_active_sidebar( 'sidebar-2'  )
    		&& ! is_active_sidebar( 'sidebar-3' )
    		&& ! is_active_sidebar( 'sidebar-4'  )
    	)
    		return;
    	// If we get this far, we have widgets. Let do this.
    ?>
    
    <?php
    /**
     * catchflames_before_footer_sidebar hook
     */
    do_action( 'catchflames_before_footer_sidebar' ); ?>
    
    <div id="footer-sidebar">
        <div id="supplementary" <?php catchflames_footer_sidebar_class(); ?>>
            <div class="wrapper">
                <?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
                <div id="first" class="widget-area" role="complementary">
                    <?php dynamic_sidebar( 'sidebar-2' ); ?>
                </div><!-- #first .widget-area -->
                <?php endif; ?>
    
                <?php if ( is_active_sidebar( 'sidebar-3' ) ) : ?>
                <div id="second" class="widget-area" role="complementary">
                    <?php dynamic_sidebar( 'sidebar-3' ); ?>
                    <?php if (is_user_logged_in()) : ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>">logout | </a>
                    <?php else : ?> <a href="<?php echo wp_login_url(get_permalink()); ?>">login | </a>
                    <?php endif;?> </aside>
                </div><!-- #second .widget-area -->
                <?php endif; ?>
    
                <?php if ( is_active_sidebar( 'sidebar-4' ) ) : ?>
                <div id="third" class="widget-area" role="complementary">
                    <?php dynamic_sidebar( 'sidebar-4' ); ?>
                </div><!-- #third .widget-area -->
                <?php endif; ?>
            </div><!-- .wrapper -->
        </div><!-- #supplementary -->
    </div><!-- #footer-sidebar -->
    
    <?php
    /**
     * catchflames_after_footer_sidebar hook
     */
    do_action( 'catchflames_after_footer_sidebar' ); ?>

    Regards,
    Mahesh

    February 10, 2016 at 1:09 pm #85076
    andrewf90
    Member

    Hey, again! 😛

    So I downloaded the child theme sample and I copied the first code snippet to the functions.php file and created the second file and inserted the second code snippet, but it looks like the footer area stayed the same. What might I be doing wrong? Sorry for the trouble.

    February 10, 2016 at 1:27 pm #85079
    Mahesh
    Participant

    Hi @andrewf90,

    The code is working fine on our server (localhost). Have you activated the child theme? 🙂

    Regards,
    Mahesh

    February 10, 2016 at 1:52 pm #85085
    andrewf90
    Member

    Lol, I didn’t realize I had to do that. So the child theme is placed in its own parent folder in the /theme/ folder. When I activate it, my site doesn’t load, so I have to deactivate the child theme by changing its file name. Any idea what I might be doing wrong?

    February 10, 2016 at 2:26 pm #85087
    andrewf90
    Member

    Once again, I did something wrong. I created the folder myself and I uploaded two files. I ended up deleting that and then following the Upload Theme option through the WordPress dashboard, and voilà! It worked. I went back to the child theme folder and I noticed there were four files in total? I only uploaded the functions.php and .css files. Oh my. So, it all works. Thanks a bunch!

    February 10, 2016 at 2:35 pm #85089
    Mahesh
    Participant

    Hi @andrewf90,

    Oh that’s great.
    Glad to know that you’ve managed to make it work now.

    Regards,
    Mahesh

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Adding Login/Logout Links to Footer’ is closed to new replies.

Incompatible Archive Error in WordPress 6.4.3

How to fix the Incompatible Archive Error?

Support Forum Instructions

Use the search box below to search for your answer and also check out theme instructions at Theme Instructions before posting question here.

When you post in your question, please don't forget to post in your site URL. If you have issue in posting question here in forum then check out screencast from our YouTube channel.

Notice: Support Forum Now Requires User Moderation to Avoid Spammers

Search Forums

Popular Themes

BizBoost Pro

Buy Now

Bold Photography Pro

Buy Now

Audioman Pro

Buy Now

Catch Fullscreen Pro

Buy Now

Fotografie Pro

Buy Now

Catch Responsive Pro

Buy Now
Hire a Customizer

Recent Topics

  • iPhone Hamburger Menu and Word Menu
  • Header height
  • Thumbnail Size – Events and Category List
  • Thumbnail Size – Events and Category List
  • Hide page title in the middle of header
  • Very urgent problem with slide module
  • Cath Responsivre pro
  • Bying the latest version of Catch Evolution Pro
  • Text issue
  • Primary menu appearance
  • How to edit theme with elementor
  • Event Calendar Integration
  • FSE Pro Install error
  • my-music-band.3.7.9 pro not pro version
  • activation fse-pro limited
  • Homepage image not shown completely
  • PHP update
  • Catch Gallery: Tiled mosaic galleries are not sizing properly
  • Error on FSE PRO
  • Invalid License Key
  • Theme not showing Main Sidebar in Widgets section
  • unable to update from 2.0.2 to 2.1
  • Featured Image
  • URGENT: issues after FSE update!!!
  • Restore deleted navigation
  • unofficial homepage/header media link
  • Double Widgets
  • every page like the front page. Possible?
  • Full Frame Pro technical problem E_COMPILE_ERROR
  • Add Theme Options to any page

Popular Tags

background blog catch box catch everest category child theme Color comments css Excerpt featured content featured image featured slider font footer header header image homepage Home Page image images layout logo menu mobile navigation padding page portfolio post posts responsive search sidebar Simple Catch site title slider theme title update widget widgets width woocommerce wordpress

Featured Posts

  • Best Free WordPress Block Themes for Full Site Editing for 2024
  • 40+ Best Free Business WordPress Themes for 2024
  • 30+ Best Free WordPress Themes for 2024
  • 25+ Best Free Music WordPress Themes for 2024
  • Our Top 10+ Free and Premium Photography WordPress Themes Collection 2024
  • Our Free and Premium Music WordPress Themes Collection

Donate Now

Click on the Donate button below to Support Free Themes, Free Plugins, and Free Support. All donations are used for the development and improvement of free themes, plugins, and support. Thanks for your contribution.
  • Home
  • About Us
  • Contact Us
  • Join Our Team
  • Terms & Conditions
  • Privacy Policy
  • Facebook
  • Twitter
  • Linkedin
  • Scroll Up
  • Pinterest
  • Youtube
  • Instagram
© 2012 - 2025 Catch Themes: Premium WordPress Themes. All rights reserved.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie settingsGot it!
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT