Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Removed hardcoded path to theme #4

Open
wants to merge 3 commits into from

2 participants

@andrewheiss

Hardcoded paths to the theme were causing images to not load when the WordPress installation was in a subdirectory. I replaced all instances of /wp-content/themes/pear/ with the with more dynamic get_template_directory_uri();

I also replaced the link to the home page in the logo with the more dynamic echo site_url();

andrewheiss added some commits
@andrewheiss andrewheiss Removed hardcoded path to theme
Replaced it with more dynamic gett_template_directory_uri()
bcab485
@andrewheiss andrewheiss Replaced hardcoded home link
Replaced the hardcoded "/" in the logo with the more dynamic `echo
site_url();`
189af06
@Mamaduka

You should use home_url() to echo out this, cause site_url() retrieves current path of WordPress files directory and sometimes this can be different from home.

Good catch. I've fixed it now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 7, 2012
  1. @andrewheiss

    Removed hardcoded path to theme

    andrewheiss authored
    Replaced it with more dynamic gett_template_directory_uri()
  2. @andrewheiss

    Replaced hardcoded home link

    andrewheiss authored
    Replaced the hardcoded "/" in the logo with the more dynamic `echo
    site_url();`
  3. @andrewheiss
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 4 deletions.
  1. +1 −1  footer.php
  2. +1 −1  header.php
  3. +2 −2 loop-single.php
View
2  footer.php
@@ -6,7 +6,7 @@
<p class="cc">This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License</a>.</p>
- <p><a href="http://simplebits.com" id="sb"><img src="/wp-content/themes/pears/images/sb-black.png" /></a></p>
+ <p><a href="http://simplebits.com" id="sb"><img src="<?php echo get_template_directory_uri();?>/images/sb-black.png" /></a></p>
</div> <!-- /footer -->
<!-- jQuery -->
View
2  header.php
@@ -24,7 +24,7 @@
<body <?php body_class(); ?>>
<header role="banner" class="group">
- <a href="/" id="logo">
+ <a href="<?php echo home_url(); ?>" id="logo">
Pears <em>are common patterns of markup &amp; style</em>
</a>
</header>
View
4 loop-single.php
@@ -33,14 +33,14 @@
<div class="group">
<div id="markup" class="mod">
- <h3 class="label">HTML</h3> <a href="#" class="clip" title="select code for copying"><img src="/wp-content/themes/pears/images/icon-copy.png" alt="copy" /></a>
+ <h3 class="label">HTML</h3> <a href="#" class="clip" title="select code for copying"><img src="<?php echo get_template_directory_uri();?>/images/icon-copy.png" alt="copy" /></a>
<textarea class="mod-ta">
<?php $key="html"; echo get_post_meta($post->ID, $key, true); ?>
</textarea>
</div>
<div id="style" class="mod">
- <h3 class="label">CSS</h3> <a href="#" class="clip" title="select code for copying"><img src="/wp-content/themes/pears/images/icon-copy.png" alt="copy" /></a>
+ <h3 class="label">CSS</h3> <a href="#" class="clip" title="select code for copying"><img src="<?php echo get_template_directory_uri();?>/images/icon-copy.png" alt="copy" /></a>
<textarea id="css-code" class="mod-ta">
<?php $key="css"; echo get_post_meta($post->ID, $key, true); ?>
</textarea>
Something went wrong with that request. Please try again.