Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirect site title when clicked


  • things15
    Participant

    @things15

    I want to redirect site title when clicked to the activity page regardless of the front page.
    Actually I need my front page to be a welcome page something like facebook though I’ve already set up login redirect to the activity page but once I’m logged in & click on the site title it should show the activity page again something like facebook feeds & not the front page which I plan to use as a welcome page.

Viewing 4 replies - 1 through 4 (of 4 total)

  • danbp
    Participant

    @danbp

    Hi,

    an option could be to change the default behave of the site title by modifying this from within your child theme.

    This URL is generally hardcoded in header.php. For example, Twenty Sixteen use this:

    <?php if ( is_front_page() && is_home() ) : ?>
    	<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    	<?php else : ?>
    <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
    	<?php endif;

    Of course, this can vary from one theme to another. But that’s the idea.

    From this, you can play with the conditionnals or add activity to the URL.


    things15
    Participant

    @things15

    Thanks for the reply, I think I have a similar code in my theme’s header file but as I’m new to coding & don’t know what to change so could you please provide the correct code/function where site-title is activity page regardless of the front page which I can add to the header.php under a child theme. Thanks.

    Here’s my site:

    http://www.thingsfail.com


    danbp
    Participant

    @danbp

    In wp settings, define a static page as homepage (wich will be your welcome page), and don’t use BP “activity” page. Dashboard > Settings > Read

    Add all BP items (activity, members, groups, …) to a menu ( haven’t seen them).

    And for your site title link, use something like this:
    instead of home_url( '/' ), replace by home_url( '/activity' ) for both if/else


    things15
    Participant

    @things15

    Thanks for a quick turn-around. I implemented your solution by creating a new header.php in my child theme containing only the above code & now my site is blank. Do I need to copy the entire code of parent theme’s header.php file to the child’s header.php or do I need to add it as a function as far as I’m aware with functions.php we use filters/actions(no idea how it works though).

    Please guide me on where exactly the code will go. Below header.php code for site-title:

    <?php if ( is_front_page() || is_home() ) : ?>
    
    							<h1 id="site-title">
    
    								<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
    
    							</h1>
    
                      <?php else : ?>
    
                         <h3 id="site-title">
    
                            <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
    
                         </h3>
    
                      <?php endif; ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar