I need help to add nofollow in my wordpress php file

Discussion in 'PHP' started by carl73a, May 16, 2010.

  1. #1
    Hi,
    I wonder if there is a way to add nofollow for wordpress static front page. I would like to apply nofollow tag for my "Home" link. Is there a specific way to do it from the header.php. This is how my header looks like:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes('xhtml'); ?>>
    	<head profile="http://gmpg.org/xfn/11">
    
    	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    	<meta name="language" content="en" />
    
    	<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :'; } ?> <?php bloginfo('name'); ?></title>
    	<link rel="shortcut icon" href="<?php echo bloginfo('template_url'); ?>/images/favicon.ico" type="image/x-icon" />
    
    	<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    	<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> <?php _e("RSS Feed", 'studiopress'); ?>" href="<?php bloginfo('rss2_url'); ?>" />
    	<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> <?php _e("Atom Feed", 'studiopress'); ?>" href="<?php bloginfo('atom_url'); ?>" />
    	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
    	<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    	<?php wp_head(); ?>
    
    	<script type="text/javascript"><!--//--><![CDATA[//><!--
    		sfHover = function() {
    			if (!document.getElementsByTagName) return false;
    			var sfEls = document.getElementById("nav").getElementsByTagName("li");
    			<?php // if you only have one main menu - delete the line below ?>
    			var sfEls1 = document.getElementById("subnav").getElementsByTagName("li");
    			for (var i=0; i<sfEls.length; i++) {
    				sfEls[i].onmouseover=function() {
    					this.className+=" sfhover";
    				}
    				sfEls[i].onmouseout=function() {
    					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    				}
    			}
    			<?php // if you only have one main menu - delete the "for" loop below ?>
    			for (var i=0; i<sfEls1.length; i++) {
    				sfEls1[i].onmouseover=function() {
    					this.className+=" sfhover1";
    				}
    				sfEls1[i].onmouseout=function() {
    					this.className=this.className.replace(new RegExp(" sfhover1\\b"), "");
    				}
    			}
    		}
    		if (window.attachEvent) window.attachEvent("onload", sfHover);
    //--><!]]></script>
    </head>
    
    <body>
    
    <div id="wrap">
    
    <div id="header">
    
    	<div class="headerleft" <?php if(get_theme_mod('header_blog_title') != 'Text') { echo 'id="imageheader"'; } ?>>
    		<?php
    			if (is_home()) {
    				echo '<h1><a href="'.get_option('home').'/">'.get_bloginfo('name').'</a></h1>';
    			} else {
    				echo '<h4><a href="'.get_option('home').'/">'.get_bloginfo('name').'</a></h4>';
    			}
    		?>
           <p><?php bloginfo('description'); ?></p>
    	</div>	
    	
    	<?php // To define the 468x60 ad, go to your WP dashboard and go to Appearance > Widgets. Select 468x60 Header Banner and then enter your add code into a text widget ?>
    		
    	<div class="headerright">
            <ul id="headerwidgeted">
           		
                <li><?php echo adrotate_banner('4'); ?></li>
    
            </ul>
    	</div>
    
    </div>
    
    <div id="navbar">
    
    	<div id="navbarleft">
    		<ul id="nav">
    			<li><a href="<?php echo get_option('home'); ?>"><?php _e("Home", 'studiopress'); ?></a></li>
    			<?php wp_list_pages('title_li=&depth=4&sort_column=menu_order&exclude=329,333,337'); ?>
    		</ul>
    	</div>
    	
    	<div id="navbarright">
    		<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    		<input type="text" value="<?php _e("Search this website...", 'studiopress'); ?>" name="s" id="searchbox" onfocus="if (this.value == '<?php _e("Search this website...", 'studiopress'); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e("Search this website...", 'studiopress'); ?>';}" />
    		<input type="submit" id="searchsubmit" value="<?php _e("Search", 'studiopress'); ?>" /></form>
    	</div>
    	
    </div>
    
    <div class="clear"></div>
    
    <div id="subnavbar">
    	<ul id="subnav">
    		<?php wp_list_categories('orderby=name&title_li=&depth=4_li=&exclude=1'); ?>
    	</ul>
    </div>
    
    <div class="clear"></div>
    Code (markup):
    Many thanks in advance
     
    carl73a, May 16, 2010 IP