homepage Welcome to WebmasterWorld Guest from 54.205.254.108
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

    
Need Help With WordPress
Can't get images to appear on main page
badjocks




msg:4133553
 2:40 pm on May 16, 2010 (gmt 0)

Not sure if this is the right place to post this, so please let me know if not.

I am new to WordPress and have done pretty well so far getting it installed at my domain, installed a theme (Mimbo 3.0) along with a bunch of plugins, etc.

My magazine-style theme allows for pictures or thumbnails to appear along with a snippet of text on the main page. My problem is that I can't get the images to appear . . . not even sure what I am supposed to do to make that happen. I have posted questions at the WordPress.org forum, looked through theme FAQs, searched Google and still can't seem to find the answer. I have installed and uninstalled several plugins and none of them seem to work.

Not sure if it is a problem with a plugin, page coding or user error. Likely I need someone to hold my hand through the process. How do I find a WordPress expert who can help me with this?

 

londrum




msg:4133558
 2:53 pm on May 16, 2010 (gmt 0)

need a bit more info. where do the images come from? if the images are associated with each post then presumabely you upload them everytime you make a post. if they are generic icon-type things, then where are you storing them?

maybe you should look at the source code first, and see if there's an <img> tag, and what the URL is pointing at.

badjocks




msg:4133568
 3:12 pm on May 16, 2010 (gmt 0)

The images have come from several places. Some are my own, some are stock that I purchased. And yes, I have uploaded them with the posts and they show up in the posts themselves fine. With my theme, it pulls the last X-number of posts to the main page. As I said, the snippets of text from the posts show up fine, but it doesn't pull the images.

Not sure if looking at the code will help since it is all done in PHP and there seems to be different pieces of code all over the place that get pulled together to form the main page (unlike a good old-fashioned HTML page). The info I am finding online seems to point to it being a problem with a WordPress plugin, which is why I am looking for a WP expert to walk me through it. I am willing to pay for the right person because I know it will save me any additional hours struggling with this mess. The only thing is, I don't know how to go about finding a legitimate WP expert.

londrum




msg:4133572
 3:28 pm on May 16, 2010 (gmt 0)

you dont have to pay anyone, it should be pretty easy for us to tell you.
have a look at the index.php page in your theme. it sounds like there's probably a line there that says something like
the_excerpt()
thats the bit that prints out the words for each post.

paste the code either side of it here, so we can see what it says (straight from the php file, not the source code).

/edit/

actually... it would be easier if you just try this...
uninstall the plugin that is supposed to print the image.
and then open up the functions.php file in your theme's directory.
paste this into it...

function post_image(){$a=1;global $b;$b=1;$c=get_permalink();$d=get_the_content();
$e=substr_count($d,'<img');$f=0;for($i=1;$i<=$e;$i++){$g=strpos($d,'<img',$f);
$h=substr($d,$g);$j=strpos($h,'>');$k=substr($h,0,$j+1);
$k=preg_replace('/width="([0-9]*)" height="([0-9]*)"/','',$k);$l[$i]=$k;$f=$j+1;}
if(stristr($l[$a],'<img')){echo'<a href="'.$c.'">'.$l[$a]."</a>";}$b=0;}

and then open up the index.php page in your theme's directory, and paste this where you want the image to appear -- probably somewhere near where it says
the_excerpt()

<?php post_image(); ?>

and then it should work

badjocks




msg:4133607
 4:50 pm on May 16, 2010 (gmt 0)

Thanks I will look at the functions.php in a minute.

Here is the code that I think defines the top "feature" post:

<?php
$postCount = 0;
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts( 'paged=$page&post_per_page=-1&cat=' . get_query_var('cat') );
while (have_posts()) { the_post();
if( $postcount == 0 ) {
//GETS LATEST OR STICKY POST
?>

<div id="lead" class="clearfloat">

<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
<?php echo get_post_image (get_the_id(), '', '', '' .get_bloginfo('template_url') .'/scripts/timthumb.php?zc=1&amp;w=260&amp;h=230&amp;src='); ?></a>

<div id="lead-text">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
<?php the_title(); ?></a> <span class="commentcount"> (<?php comments_popup_link('0', '1', '%'); ?>)</span></h2>


<p class="date"><?php the_time('n/d/y'); ?> &bull; </p>
<?php the_excerpt(); ?>
</div>
</div><!--END LEAD/STICKY POST-->

badjocks




msg:4133711
 9:18 pm on May 16, 2010 (gmt 0)

Not sure what I did, but it seems to be working now. Many thanks for your suggestions!

I now understand the love/hate relationship some people have with WordPress.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved