I'm trying to do that right now but every time i try to save the file it gives me this
Parse error: syntax error, unexpected $end in /nfs/c10/h02/mnt/142167/domains/yardsale.cdcwebdesign.com/html/wp-content/themes/base/functions.php on line 199
Ok, I got rid of my stuff and put yours and now it's saying this:
Fatal error: Call to undefined function catch_that_image() in /nfs/c10/h02/mnt/142167/domains/yardsale.cdcwebdesign.com/html/wp-content/themes/base/includes/loop.php on line 3
that probably means I'm still calling my code and not yours right?
Fatal error: Cannot redeclare echo_first_image() (previously declared in /nfs/c10/h02/mnt/142167/domains/yardsale.cdcwebdesign.com/html/wp-content/themes/base/includes/loop.php:4) in /nfs/c10/h02/mnt/142167/domains/yardsale.cdcwebdesign.com/html/wp-content/themes/base/includes/loop.php on line 27
I could do that but not until very late tonight. If I were you, I'd post your problem on stackoverflow.com. I believe you need to use wp_get_attachments to get the first image of every post.
http://www.wprecipes.com/how-to-get-the-first-image-from-the-post-and-display-it This is a wordpress problem. I put the code where it said to in my functions and loop files. but all it outputs is the url of the image. here is my site http://www.yardsale.cdcwebdesign.com. And no I am not trying to steal the picture a the top of the page i will pay for it when the site goes live. thanks in advance
@chanman Did you remove anything? Paste the exact code you put inside your loop.
Or you can try this:
This is what is in my entire loop.php file
Sorry I posted the loop instead of functions I'll post it in the morning.
This is just the top of the functions.php file
@chanman Remove what you previously used and try the code I provided for you and put it in your theme file.
You also seem to have an error in your functions.php file. I cannot access your site at all.
I'm trying to do that right now but every time i try to save the file it gives me this
@chanman Line 199 seems to be fixed now. You have an error on line 3 in loop.php. Perhaps that is
<?php catch_that_image(); ?>If so, remove that.
I figured out the problem i left out the last } in your code.
Ok, I got rid of my stuff and put yours and now it's saying this:
that probably means I'm still calling my code and not yours right?
This is whats on line 3
@chanman The code I provide you with goes into the theme file (loop.php) not functions.php and you still have an error on line 3 in loop.php.
@chanman Yes. Above I asked you to remove that.
I thought it went in the functions file let me change it real quick and see what i get.
@chanman Wrap it in php tags
<?php THE CODE I PROVIDED GOES HERE ?>I figured that out after i saved it.
@chanman Repaste your loop.php file without changing anything.
It's giving me an error but heres the code
Here is the error it's giving me:
Sorry for all the problems I'm new to wordpress and can't figure it out yet.
@chanman Try this just for kicks.
it's not working for me and it's not giving an error you go check it out. http://www.yardsale.cdcwebdesign.com
I don't know if this matters but on the first post the image is in my media library and the second and third post they are called from the mapbox api.
@chanman I might know a fix for your previous code. Repaste your old code into functions.php and loop.php but instead of
<?php catch_that_image(); ?>do this:
<img src="<?php catch_that_image(); ?>" />didn't work
here is the loop
here is the fuctions
it's not giving an error either.
@chanman Remove the img tag and just try
<?php catch_that_image(); ?>to see if it outputs anything.nothing yet.
Then you must have changed something. Are you trying to get the first image of every post?
yep, i'm not very good at php yet. Do you know of a way you access my code to help me? Is there a way to ad an admin to wordpress or a temp admin?
Maybe we could open a talk.io and put our email address in it and me send you the files.
Would it work to add you as a user just while your helping me?
I could do that but not until very late tonight. If I were you, I'd post your problem on stackoverflow.com. I believe you need to use wp_get_attachments to get the first image of every post.
thanks for all your help i'll try it.