• Hello
    I’m using 2 custom fields on my blog. One is called Image and the other is URL.
    When I enter them both on the write post page, only the one I entered last is working.
    Example:
    First I enter URL, and I click add custom field.
    Then I enter Image and click add custom field.
    Then I post my message.
    But only the data from Image has been saved.
    When I go back by clicking edit post, my Custom field ‘URL’ has disappeared. I enter it again and click save and now are they working both.
    But I want it to save it directly from the first time, because this is taking a lot of time.
    Here is my code:

    <?php get_header(); ?>
      <div id="content">
    
      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
          <div class="post-nav">
             <span class="previous"><?php previous_post_link('%link') ?></span>
             <span class="next"><?php next_post_link('%link') ?></span>
          </div>
    <?php the_date('','<center><div class="datebar"><div class="datetext">Movie posted on ','</div></div></center>'); ?>
          <div class="post" id="post-<?php the_ID(); ?>">
             <div class="title">
    <div id="thumbnail">
          <?php
    // this grabs the URL
    	$values = get_post_custom_values("URL");
    // this checks to see if an image file exists
    	if (isset($values[0])) {
    ?>
          <?php } ?>
    <table border="0">
    <tr>
    <td rowspan="2">
    <?php
    // this grabs the image filename
    	$values = get_post_custom_values("Image");
    // this checks to see if an image file exists
    	if (isset($values[0])) {
    ?>
          <a href="<?php $values = get_post_custom_values("URL"); echo $values[0]; ?>" target="_blank" rel="bookmark"><img src="<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="" /></a>
          <?php } ?>
    </td>
    <td>
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2><div class="cattext">(<?php the_category(', ') ?>)</div>
    </div>
    </td>
    </tr>
    <tr>
    <td>
    <div class="entry">
                <?php the_content('Continue reading &raquo;'); ?>
    
    </td>
    </tr>
    </table>
    
    </div><!--/entry -->
            </div><!--/post -->
    </div>
    
    	<?php endwhile; else: ?>
    
             <p>Sorry, no posts matched your criteria.</p>
    
    	<?php endif; ?>
    
    	</div><!--/content -->
    
      		<div id="footer">
    		  	<span class="mangoorange">
             <a href="https://www.i3theme.com">i3Theme 1.6</a> is designed by <a href="https://www.ndesign-studio.com">N.Design Studio</a>, customized by <a href="https://www.mangoorange.com/">MangoOrange&trade;</a>, <br /> sponsored by <a href="https://www.web-hosting-top.com/">Web Hosting Reviews &amp; Free Coupons</a> and <a href="https://www.b4udecide.com/">Web Hosting</a>.
             </span>
    		</div>
    
    </div><!--/left-col -->
    
    <?php
    $current_page = $post->ID; // Hack to prevent the no sidebar error
    include_once("sidebar-right.php");
    ?>
    
    <?php get_footer(); ?>

    I hope you see a fault in the code and help me out.
    Thanks for looking!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter scorp89

    (@scorp89)

    Anyone can help me please.

    Maybe it is the name (URL) of the custom field that is causing edit post problems. Try using something like My URL as the name instead.

    No this has been happening to me too since I upgraded to 2.5.1 No matter what the names of the custom fields or the order, it will only save the last one. It’s really irritating. But I’ve found that if you enter in the first field, then scroll up and save the page, you can enter in the rest and when you publish it’ll save all custom fields the first time.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Entering text in 2 custom fields, only 1 is working’ is closed to new replies.