Title: Sidebar.php &#038; WP Formatting
Last modified: August 18, 2016

---

# Sidebar.php & WP Formatting

 *  [mikejeffs](https://wordpress.org/support/users/mikejeffs/)
 * (@mikejeffs)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/sidebarphp-038-wp-formatting/)
 * I’m trying my best to get an iframe into the sidebar on the default theme.
 * I’m guessing that it it’s something to do with the way WP autoformats content
   that is stopping it from working. This is the code I want to include:
 * <iframe src=http://rcm.amazon.com/e/cm?t=easymentalism-20&o=1&p=14&l=st1&mode
   =electronics&search=Mp3%20Player&fc1=&=1&lc1=&lt1=&f=ifr&bg1=&f=ifr marginwidth
   =0 marginheight=0 width=160 height=600 border=0 frameborder=0 style=border:none;
   scrolling=no></iframe>
 * After updating sidebar.php, loading wordpress index, and viewing source, all 
   I have is a blank line.
 * Is there any way I can php echo() the code out? Would WP still mess it up?
 * Any other ways?
 * thanks

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

 *  [Lorelle](https://wordpress.org/support/users/lorelle/)
 * (@lorelle)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/sidebarphp-038-wp-formatting/#post-192088)
 * It might be because this isn’t right, or it’s the way you posted it. There should
   be quote marks around each attribute like this:
 * `marginheight="0" width="160" height="600" border="0"...`
 * Using it without quotes worked in HTML, but XHTML is much more picky, and that
   might be the problem. It might be something else, but give that a try.
 *  [Avenir](https://wordpress.org/support/users/avenir/)
 * (@avenir)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/sidebarphp-038-wp-formatting/#post-192109)
 * As far as I can tell, Lorelle’s solution should work. You’ll need to add quotation
   marks around all of the values for all of your attributes, especially the src
   attribute, as a browser may read the space as part of the URI, or bork some way
   like that.
 * WordPress doesn’t fiddle with the code you insert directly into the template 
   files at all. The only code that it touches is that which you enter into entries
   or Pages created through the Page feature. WordPress will parse PHP template 
   tags included in the template files, but that shouldn’t effect your code at all.
   Make sure though that all the PHP tags around the area you’re editing are closed.
   That means for ever `<?php` you see, you should see a corresponding `?>`. Your
   problem might possibly be that there’s an open PHP tag somewhere that’s stopping
   the browser from seeing your HTML code.
 *  Thread Starter [mikejeffs](https://wordpress.org/support/users/mikejeffs/)
 * (@mikejeffs)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/sidebarphp-038-wp-formatting/#post-192197)
 * Thanks for the replies. I’d tried the iframe code before with the quotes, I removed
   to see if it would make a difference, sorry for the confusion. I enclose the 
   contents of my sidebar.php file below. I’ve tested to see if it’s a browser cache
   issue or similar by adding “Testing” around the iframe tags, when I do this the
   word “testing” shows up, but when you view source there is no sign of the iframe
   at all!?!
 * ` <div id="sidebar">
    <iframe src="http://rcm.amazon.com/e/cm?t=easymentalism-
   20&o=1&p=14&l=st1&mode=electronics&search=Mp3%20Player&fc1=&=1&lc1=&lt1=&f=ifr&
   bg1=&f=ifr" marginwidth="0" marginheight="0" width="160" height="600" border="
   0" frameborder="0" style="border:none;" scrolling="no"></iframe>
    -  <?php include (TEMPLATEPATH . '/searchform.php'); ?>
    -  <!-- Author information is disabled per default. Uncomment and fill in your
      details if you want to use it.
    - <h2><?php _e('Author'); ?></h2>
       A little something about you, the author.
      Nothing lengthy, just an overview.
    -  -->
    -  <?php /* If this is a category archive */ if (is_category()) { ?>
       You are
      currently browsing the archives for the <?php single_cat_title(''); ?> category.
    -  <?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
       You are
      currently browsing the "><?php echo bloginfo('name'); ?>
       weblog archives
      
      for the day <?php the_time('l, F jS, Y'); ?>.
    -  <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
       You 
      are currently browsing the "><?php echo bloginfo('name'); ?>
       weblog archives
      
      for <?php the_time('F, Y'); ?>.
    -  <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
       You are
      currently browsing the "><?php echo bloginfo('name'); ?>
       weblog archives
      
      for the year <?php the_time('Y'); ?>.
    -  <?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
       You
      have searched the "><?php echo bloginfo('name'); ?>
       weblog archives
       for **'
      <?php echo wp_specialchars($s); ?>'**. If you are unable to find anything 
      in these search results, you can try one of these links.
    -  <?php /* If this is a monthly archive */ } elseif (isset($_GET['paged']) &&!
      empty($_GET['paged'])) { ?>
       You are currently browsing the "><?php echo bloginfo('
      name'); ?>
       weblog archives.
    -  <?php } ?>
    -  <?php wp_list_pages('title_li=<h2>' . __('Pages') . '</h2>' ); ?>
    - <h2><?php _e('Archives'); ?></h2>
 *  -  <?php wp_get_archives('type=monthly'); ?>
 *  - <h2><?php _e('Categories'); ?></h2>
 *  -  <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0,'','','','','')?
      >
 *  <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
    - <h2><?php _e('Links'); ?></h2>
 *  -  <?php get_linksbyname('Links', '
    - ', '
    - ', '
      ', FALSE, 'name', TRUE); ?>
 *  - <h2><?php _e('Meta'); ?></h2>
 *  -  <?php wp_register(); ?>
    - <?php wp_loginout(); ?>
    - ["><?php _e('Valid XHTML'); ?>](http://validator.w3.org/check/referer)
    - [XFN](http://gmpg.org/xfn/)
    - [">WordPress](http://wordpress.org/)
    -  <?php wp_meta(); ?>
 *  <?php } ?>
 *  <?php witty(); ?>
    </div>
 *  Thread Starter [mikejeffs](https://wordpress.org/support/users/mikejeffs/)
 * (@mikejeffs)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/sidebarphp-038-wp-formatting/#post-192318)
 * Anybody got any ideas on this? Can anyone test this is their install or test 
   site?
 * I’ve tried the iframe without the closing iframe tag which someone suggested.
 * Just to clarify, when I add the above iframe code to my sidebar.php and upload
   it. I view in my browser, view source and where the iframe tag should be there
   is NOTHING.
 * thanks
 *  [Lorelle](https://wordpress.org/support/users/lorelle/)
 * (@lorelle)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/sidebarphp-038-wp-formatting/#post-192324)
 * Whoa! Too much information. The only part of your sidebar we are interested in
   was the part you already posted before. The whole thing, in this case, isn’t 
   your problem.
 * Amazon changed their code not long ago and I had to go through and change all
   of my amazon ads, which was really frustrating. Log into Amazon and make sure
   that you have the most recent version of the iframe info that you want to post.
   That might be your problem.
 * If you have the latest version, did you do a total refresh of your browser? Clear
   the cache? For MSIE: hold SHIFT and click the REFRESH button. For FF: Cntrl+SHIFT
   +R
 * To make sure that everything is “okay”, put the following in your style.css file:
 * `iframe {border:red solid 1px; padding:5px; background: green; }`
 * If you upload the stylesheet and then refresh the screen, do you see a red bordered
   and green backgrounded box sitting where the iframe should be? Then you know 
   that the iframe is “there” but the information inside isn’t. That’s when you 
   leave here and go ask the folks at Amazon why it isn’t working.
 * Be sure to get rid of the iframe style when you finally get it work…hee hee.
 *  Thread Starter [mikejeffs](https://wordpress.org/support/users/mikejeffs/)
 * (@mikejeffs)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/sidebarphp-038-wp-formatting/#post-192815)
 * Thanks for the reply.
 * I’ve tried completly clearing my cache to no avail.
 * The problem isn’t style based. The actual html for the iframe dissapears when
   it wordpress pulls the template files together to produce a page. There is no
   iframe tag in the wordpress generated html for any stylesheet to affect.
 * For example I edit sidebar.php on my pc, upload it via ftp. I can check via the“
   view” function on my ftp client that the file has correctly uploaded and the 
   iframe code exists.
 * When I view the index of my site, no iframe is displayed AND when I view the 
   source of the page there is no iframe code, just a blank line where it *should*
   be.
 * For the record, i’ve got the latest amazon code, but either way I should be able
   to write in whatever I like and WP not remove it when a page is generated.
 * I’m really confused as to what is causing this. It must sound like I’m talking
   rubbish but I’ve got pretty good experience of working with templates in various
   scripts and I’ve never come across anything like this issue.
 * BTW: I’m using the 1.51 beta version that is on the downloads page.
 *  [flammobammo](https://wordpress.org/support/users/flammobammo/)
 * (@flammobammo)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sidebarphp-038-wp-formatting/#post-193071)
 * I have the same problem as you, mikejeffs.
 * The difference I have between mikejeffs is that I’m using a different feed (from
   thinkgeek.com, my wishlist) and similarly displaying it in an iframe. I CAN get
   it to work successfully to some extend, by calling my html file with the iframe.
 * I have the problem that it doesn’t display with the correct formatting as the
   rest of the sidebar (which I’m not sure how to fix) so I copy and paste the command
   that mikejeffs uses:
 *  <div id=”sidebar”>
 *  just before calling his iframe (thinking it’d be worth a pot luck shot, as I
   really have no idea!) and blow and behold it makes the iframe disappear completely!
 * So basically mikejeffs, I suggest you try getting rid of the command above, and
   see what happens. I’d say it’ll make your iframe appear, although it will probably
   screw up your formatting. I think?
 *  [hawke2](https://wordpress.org/support/users/hawke2/)
 * (@hawke2)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/sidebarphp-038-wp-formatting/#post-193089)
 * I tried your stylesheet code to try and see if the iframe was rendering at all
   and it is not. There is no border around where the content should be. Has anyone
   gotten the amazon iframes to work? This would be an integral part of our site.

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

The topic ‘Sidebar.php & WP Formatting’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 8 replies
 * 5 participants
 * Last reply from: [hawke2](https://wordpress.org/support/users/hawke2/)
 * Last activity: [20 years, 9 months ago](https://wordpress.org/support/topic/sidebarphp-038-wp-formatting/#post-193089)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
