• hartwoodsca

    (@hartwoodsca)


    Hi, first time on the forums!

    I have a problem with my blog at https://hartwood.tirrigh.org/hartblog/ As you can see, there is a shred of PHP code showing above every post:
    id=”post-54″>
    id=”post-1″>

    I can’t figure out how to get rid of this! The PHP code looks okay, although I’m no expert on this. Can anyone tell me anything about this? Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • dimartensson

    (@dimartensson)

    Umm, well you’ve got this in the html output: <div <php> id="post-54"> which should be <div id="post-54"> so something’s going on that shouldn’t…

    Could you post the contents of your theme’s index.php (locates in wp-content/themes/theme-name/)?

    Thread Starter hartwoodsca

    (@hartwoodsca)

    <?php get_header(); ?>
    <div id="pbody">
    	<div id="content">
    
    <?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>
    			<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    				<div class="ptitle"><h2>
    <a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2></div>
    				<div class="entry">
    					<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    				<p class="postmetadata"> <?php the_time('j M Y') ?><?php the_tags('Tags: ', ', ', ''); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    			</div>
    		<?php endwhile; ?>
    		<div class="navigation">
    
    <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
    			else { ?>
    
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    				<?php } ?>
    
    		</div>
    	<?php else : ?>
    	    <?php include(TEMPLATEPATH."/404.php");?>
          	<?php endif; ?>
    </div>
    <div id="sidebar">
    <?php include(TEMPLATEPATH."/sidebar_l.php");?>
    	</div>
    </div>
    <?php get_footer(); ?>
    Thread Starter hartwoodsca

    (@hartwoodsca)

    Thank you for your help!

    dimartensson

    (@dimartensson)

    Well this is wrong:
    <a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    (the a-tag is closed before it’s receiving its’ parameters.

    I actually went and downloaded the original theme so I could compare, and here’s what it should be:
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>

    However the error you got was from earlier in the file, so I’m not sure whether this was the cause. To be honest I’m half asleep atm so I don’t think I’ll be of much more help. ??

    EDIT:
    Just realized the site broke up just like that when posted without code brackets so your index.php is probably correct.

    Can’t think of why it looks like <?php post_class() ?> is outputting <php> though or if the function actually is outputting that.

    Thread Starter hartwoodsca

    (@hartwoodsca)

    There’s a div id in there, but it looks the same on every page and changing it did nothing except… uh, bad things. ??

    Devin Price

    (@downstairsdev)

    Double check the code on your index.php template.

    Does it look like this:

    <div id="content">
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <div class="ptitle">

    If not, make the change and see what happens. Paste it in directly. I think you were missing a semi-colon.

    Thread Starter hartwoodsca

    (@hartwoodsca)

    There’s no change to the blog. One thing I noticed is that the blog entries page remained the same whether I had it on the main page or under a blog page.

    I tried this on the Main Index Template, Page Template and Single Post and it didn’t do anything to the blog, but screwed up the other pages. It’s strange because you would think it would have done *something* to the blog. Very strange!

    I really appreciate all the help I’m getting on this!

    Michael

    (@alchymyth)

    you could try to add a semicolon after: post_class();
    in this line <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
    edit: i just see, that did not work, so try next suggestion:

    if that does not work, try and replace <?php post_class() ?> with class="post" (with a space on both sides) and see if that has any effects on the layout.

    Thread Starter hartwoodsca

    (@hartwoodsca)

    I FIXED IT!!! YEAH!

    In the home.php file, there was a line that said <div <php> id=”post-<?php the_ID(); ?>”> It looked different, so I tried changing it to
    <div <?php post_class() ?> id=”post-<?php the_ID(); ?>”> and it WORKED!

    Thank you everyone for your help – I wouldn’t have figured out to look for a closed tag if it hadn’t been for you guys ??

    Happy dance!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘PHP code showing in blog’ is closed to new replies.