Support » Fixing WordPress » A different need for redirection

  • [ Moderator note: moved to How-to and Troubleshooting. ]

    After looking through the plugins on redirection, I see many good, but common reasons for redirction – mainly missing pages, changed urls, people typing a misspelled url, etc. And while there are some special use redirects there isn’t a sufficient description for me to know if they would help me.

    Here’s my situation. I have a static site. There are only two areas of the site that have constant alterations or additions, so I decided to create blog for just those two sections. The one problem I have is that the blog url will have a link to the front page of the blog in the masthead. I want to bypass the blog front page and return to home page of the static site.

    Here’s what I mean:
    The static site url is mysite.com
    the blog site url is mysite.com/wp/

    I need a redirect so that a user who visits the blog will return to the static site automatically if they click on the masthead.

    A plug-in to do that would help a lot of people who want to mix and match static and blog sites

Viewing 2 replies - 1 through 2 (of 2 total)
  • You really don’t need a plugin, some good old html will do the job. Simply make a child theme, place header.php in your child theme and make the necessary changes so the masthead redirects to your static site.

    Thanks for that information. I always knew that I could put the actual url in the header (that’s what I have in my static site). The problem is that I don’t know PHP and, so, have trouble deciphering which piece of code I need. (The only mention of url in this code seems to point to the url of the background image)

    I’ve added the code between the header tags. If someone could point me to the code that needs to be changed or eliminated, I would greatly appreciate that. It would be easier just to put the actual url I want to point to. Many thanks.

      <header id="masthead" class="site-header" role="banner">
    
        <div class="header-bg" style="background-color: <?php echo esc_attr(get_theme_mod( 'header_bgcolour', '#ffffff' )); ?>; background-image: url(<?php if (get_header_image() != '') : ?><?php header_image(); ?>
    	<?php endif; ?>);">
            
            <div class="site-branding">  
                <?php get_template_part( 'template-parts/logo-group' ); ?> 
    		<!***  added images  ***>
    		
    		
      
            </div><!-- .site-branding -->
            
            <nav id="site-navigation" class="site-navigation primary-navigation" role="navigation">
                <div class="toggle-container visible-xs visible-sm hidden-md hidden-lg">
                  <button class="menu-toggle"><?php esc_html_e( 'Menu', 'emphasize' ); ?></button></div>
                
                <?php if ( has_nav_menu( 'primary' ) ) {																			
                        wp_nav_menu( array( 							
                            'theme_location' => 'primary', 
                            'menu_class' => 'nav-menu'
                                                        
                        ) ); } else {
                    
                        wp_nav_menu( array(															
                            'container' => '',
                            'menu_class' => '',
                            'title_li' => ''							
                            ));							
                       } 
                    ?>                    
              </nav> 
              </div>
        <!div id="header-footer"><!/div>    
        
        <?php if( get_theme_mod( 'hide_shadow' ) == '') { ?>
    		<?php // If no banners are published - display the header shadow
                if (  ! is_active_sidebar( 'full-banner'  )) 	
                echo '<div id="shadow"><img src="' . esc_url( get_template_directory_uri() ) . '/images/shadow.png" alt="shadow"/></div>';	
            ?>
         <?php } ?>
        
        </header>  
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘A different need for redirection’ is closed to new replies.