go41

quick question on custom field for adding images

von Joern am 12. Jun. 2010 | Keine Kommentare

I figured out my last issue. I am using realpress a property search and listing plug in for wordpress. The problem is that when you enter a search for a particular property, the resulting listing only gets you the title of the property and the excerpt, not the image. I have to add an html <img> tag inside the excerpt

everytime I write a post. I much rather set a custom field and simply cut/paste the absolute path to the image in it and then update/publish my post. That is only possible if the custom field is read in the index.php file so that each post automatically generates an image.
Can you tell me what is the code that will cause the php code to include an image.
and where would I put it.
Here is my index.php file
Code:

<?php get_header(); ?>

      <div class="span-24" id="contentwrap">

         <div class="span-16">

            <div id="content">

                <?php if(is_home()) { include (TEMPLATEPATH . '/featured.php'); } ?>

               <?php if (have_posts()) : ?>

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

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

                     <h2 class="title">" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h2>

                     <div class="postdate">Posted by <?php the_author() ?> on  <?php the_time('F jS, Y') ?> <?php if (current_user_can('edit_post', $post->ID)) { ?> | <?php edit_post_link('Edit', '', ''); } ?></div>

                     <div class="entry">

                                <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(200,160), array("class" => "alignleft post_thumbnail")); } ?>

                        <?php the_excerpt(''); ?>

                        <div class="readmorecontent">

                           " rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">Read More »

                        </div>

                     </div>
                  </div><!--/post-<?php the_ID(); ?>-->
            <?php endwhile; ?>

            <div class="navigation">

               <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>

               <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>

               <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>

               <?php } ?>

            </div>

            <?php else : ?>

               <h2 class="center">Not Found</h2>

               <p class="center">Sorry, but you are looking for something that isn't here.</p>

               <?php get_search_form(); ?>
            <?php endif; ?>

            </div>

         </div>
      <?php get_sidebars(); ?>

   </div>
<?php get_footer(); ?>

Thanks
Omar

(von: omerkhan02)

Hier noch 1 weitere Ergebnisse dieses Threads:

Re: quick question on custom field for adding images :: Reply by Joern

12. Jun. 2010 (von: Joern)

so you managed the category 3 problem, okay.Here it's about the post thumbnail, where you could easily use the function like in arthemia to query for a custom field and load an image if there is.basicly you have to replace…

Autor:

Du findest mich auch auf Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

weitere forum Beiträge: