Jump to content
Killersites Forums

PHP Error in WP


Recommended Posts

I've just spent the last 5 days wrestling with trying to move a Wordpress site from one hosting account's subfolder to the primary folder in a new hosting account - NOTHING worked as expected.

 

Now, the basics seem to have fallen in place, but on my index page www.aandbwebdesign.com, I get this error:

 

Warning: Missing argument 1 for get_post(), called in /hermes/bosweb/web080/b807/ipg.aandbwebdesign/wp-content/themes/aAndbWebDesign/page.php on line 4 and defined in /hermes/bosweb/web080/b807/ipg.aandbwebdesign/wp-includes/post.php on line 241

 

no idea why this is, the theme is exactly as it was on the with the other host. This is page.php

 

<?php get_header(); ?>
<?php if (is_page('Home')) : ?>


       <?php $post = get_post();
       echo $post ->post_content;
       ?>


       <?php else: ?>

       <?php if (have_posts()) : ?>
       <?php while (have_posts()) : the_post(); ?>

               <?php the_content('Read More ....'); ?>

           <?php endwhile; ?>

<?php next_posts_link('< Older Entries'); ?>
<?php previous_posts_link('Newer Entries >'); ?>

           <?php else : ?>
Not Found

… and you still haven't found what you're looking for (sing it, Baby)
       <?php endif; ?>


       <?php endif; ?>
       <?php if (is_page('Home')) : ?>

           <? endif; ?>

       <?php get_sidebar();?>
       <?php get_footer(); ?>

 

I have no clue.

Link to post
Share on other sites

I saw this problem a few years ago but I cannot recall how I solved it but I did run across this post http://lists.automattic.com/pipermail/wp-trac/2008-April/025821.html

 

It's for earlier WP versions but it wouldn't hurt to check it.

 

Oh, have you checked to make sure the paths are correct??

 

/hermes/bosweb/web080/b807/ipg.aandbwebdesign/wp-content/themes/aAndbWebDesign/

 

I am not familiar with iPage folder structure.

Edited by newseed
Link to post
Share on other sites

According to this page:

 

http://codex.wordpress.org/Function_Reference/get_post

 

it looks like you need to specify the id of the post you want to get. If you find the page id of the home page and place it within the parenthesis like so (assuming your home page id is 7):

 

$post = get_post(7);

 

That should fix it. I'm not sure why it's working fine on your other installation of WP though.

 

I believe you can find that page id by logging in to wordpress, going to the "Posts" section, and placing your mouse over the "Edit" link on the home page post. You should get something like this:

 

http://www.yourdomain.net/wp-admin/post.php?action=edit&post=268

 

I believe the value after "post=" is the page id.

Link to post
Share on other sites

Thank you guys. Newseed's link had the answer.

 

I wonder so... Wordpress has just come out with another upgrade which I am using right now. When I initially built the template while following along the video tutorial, I was using the previous version. The part of the php that's affected, Jon called 'an API hack'. Maybe it's something that doesn't work in the very latest Wordpress version.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...