Support » Fixing WordPress » Adding Links to HTML pages

  • I am new to wordpress, but found an awesome tutorial on for creating a blog page within a pre-built site. I am using DreamWeaver CS6 and have created what calls a child theme, however, I cannot get the links to link to the proper folder. Here is the the PHP that I have put into my functions.php within this child theme:

    function siteRoot($theFolder) {
    	$home = get_home_url();
    	// strpos(string, substring)
    	$thePosition = strpos($home,$theFolder);
    	// substr (string, start, length)
    	$thePath = substr($home, 0, $thePosition);
    	return $thePath;
    } ?>

    Then I have this code in my header.php file:
    < li id="home"><a href="<?php echo siteRoot('blog'); ?>index.html"><h1>Custom Suits Dallas</h1></a></li>

    This issue is that when I follow the links, it takes me to localhost://suits_index.html
    but, it should link to:

    Is there a way to correct the siteroot folder within wordpress? Is my code wrong? Have I taken a wrong path to linking my prebuilt site? Any directiion would be greatly appreciated.

    James B

Viewing 2 replies - 1 through 2 (of 2 total)
  • I never built anything locally so no experience there, but does home_url() don’t work in this case ?

    I am new to this too but I got a similar issue but found out that if you change the Page properties of the header.php and change the document type to XHTML 1.0 Transitional the codes work. Mine was in HTML5 document type. As for your issue also just try changing the ‘blog’ to ‘suits_blog’ in your code.
    < li id="home"><a href="<?php echo siteRoot('suits_blog'); ?>index.html"><h1>Custom Suits Dallas</h1></a></li>
    Hope that helps.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding Links to HTML pages’ is closed to new replies.