• Resolved nicog

    (@nicog)


    I have 2 WordPress blogs and in othe of them I have configured some custom fields and when I tried to do the same in the other blog, it just didn’t work.

    So what I’m planning to do is copy the file which contains the configuration of the custom fields from the blog that works and replace the file in the on that doesn’t work.

    The question is where is that file????? I can’t find it, does anyone know????

Viewing 3 replies - 1 through 3 (of 3 total)
  • Custom fields are stored in the database. Not in a file.
    Easier just to create the custom fields in your new blog, than trying to export / import them.

    Thread Starter nicog

    (@nicog)

    I created it already, but it doesn’t work the way it works in the other blog. That’s why I wanna copy it.

    The custom field I’m looking for is to add an image to the post preview in the homepage. I need the custom field to say only “image” as key and not the three options description, keyword and text.

    Could you be more precise in the location of the database? Thanks in advance!

    I’m using the exact samt thing.
    Here is my code:

    if (have_posts()) : while (have_posts()) : the_post();
      /*   Get attributes from post */
      	  $related_image_url = get_post_custom_values("related_image");
      	  $related_alternate_image_url = get_post_custom_values("alternative_image");
          $related_url = get_post_custom_values("related_url");
    
          $imgTitle = get_post_custom_values("image_title");
          $imgUrl = '';
          $imgHtml = '';
    
          //If an alternate image is used, this will be used as thumbnail
          if (!empty($related_alternate_image_url[0]))
             $imgUrl = $related_alternate_image_url[0];
          else
             $imgUrl = $related_image_url[0];
    
          // Create image URL and add image text if it exsists
          // Identifies if the URL is for an external image or local image
    
          if (stristr($imgUrl, 'https://') == true){
          	$imgHtml = '<img src="' . $imgUrl .'" alt="' . $imgTitle[0] . '" />';
          }
          else {
          	$imgHtml = '<img src="' . get_option('home') . '/wp-content/uploads' . $imgUrl .'" alt="' . $imgTitle[0] . '" />';
          }
      		 ?>

    Make sure that your custom fields matches what you write in the code, in this case “related_image”: get_post_custom_values(“related_image”);

    I don’t remember what tables in the DB stores the custom fields.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Where are the custom fields files??’ is closed to new replies.