1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Filling up Custom fields with automation

Discussion in 'Blogging' started by Owlpic, May 29, 2010.

  1. Owlpic

    Owlpic Regular Member

    Joined:
    Mar 8, 2010
    Messages:
    224
    Likes Received:
    80
    Occupation:
    Software Engineer
    Location:
    Dallas
    Hi,

    I have 4 custom fields in Wordpress:

    Field1: XXXXX
    Field12: XXXXX is good
    Field13: XXXXX is available for discount
    Field14: Grab XXXXX here

    As you can see that Field12, Field13 and Field14 totally depends on Field1.

    Currently I am manually filling up all these in Custom Fields box of Post page in Wordpress.

    Please guide me how I can automate this by just filling up Field1 so that other fields gets filled up. Any kid of help is appreciated.

    Thanks,
    Rajesh
     
  2. xXSebaSXx

    xXSebaSXx Registered Member

    Joined:
    May 8, 2009
    Messages:
    52
    Likes Received:
    28
    I don't see why you would need 4 custom fields to accomplish this... I would just use two custom fields.

    Field1: Let's assume that this is the url to the offer you're promoting.
    Field2: Lets use this one as the anchor text you're going to use.

    And then I would edit my single.php file and use the get_post_meta() function to create the other lines like this:

    So for XXXXX is good you would have:
    Code:
    <?php echo get_post_meta($post->ID, "Field2", $single = true); ?> is good.
    
    For XXXXX is available for discount you would have:
    Code:
    <?php echo get_post_meta($post->ID, "Field2", $single = true); ?> is available for discount.
    
    for Grab XXXXXX here you would have:
    Code:
    Grab <a href="<?php echo get_post_meta($post->ID, "Field1", $single = true); ?>" title="Field2" target="_blank"><?php echo get_post_meta($post->ID, "Field2", $single = true); ?></a> Here!
    
    Hope this helps.
     
  3. Owlpic

    Owlpic Regular Member

    Joined:
    Mar 8, 2010
    Messages:
    224
    Likes Received:
    80
    Occupation:
    Software Engineer
    Location:
    Dallas
    xXSebaSXx, thanks for such a fast response.

    Let me elaborate the scenario:

    Field1 is Thumbshots URL: XXXXX
    Field2 is AISEO Title Tag: XXXXX is good
    Field3 is AISEO Description Tag: XXXXX is available for discount
    Field4 is AISEO Keywords Tag: XXXXX discounts, XXXXX coupons

    AISEO: All In SEO plugin
     
  4. xXSebaSXx

    xXSebaSXx Registered Member

    Joined:
    May 8, 2009
    Messages:
    52
    Likes Received:
    28
    You're saying that XXXXX is the url to a thumbnail image so you could edit your php to look like this:

    Code:
    Grab <a href="<?php echo get_post_meta($post->ID, "Field1", $single = true); ?>" title="Field2" target="_blank"><?php echo get_post_meta($post->ID, "Field2", $single = true); ?></a> Here!
    
    To look like this:

    Code:
    <img src="<?php echo get_post_meta($post->ID, "Field1", $single = true); ?> />
    
    As for the AISEO tags... You're "elaboration" says that you will be using the thubshots url as part of the tags as well... XXXXXX in all fields and XXXXXX means thumbsots url... That doesn't make sense.
    I'm assuming that for the AISEO fields you'll be using the Anchor Text...

    There is no way that I know of for referencing a custom field from another custom field within the post editing interface in WP. But what you can do is disable AISEO for that post and edit your header.php page and add the Title, Description and keyword header tags using the get_post_meta() function. You would have to put the function inside an IF.... THEN conditional to only do it in single post pages and not on archives, home page, search results, etc... but that isn't too complicated.
    I suggest you go to the WP website and search template tags and read up on them.
     
    • Thanks Thanks x 1
  5. Owlpic

    Owlpic Regular Member

    Joined:
    Mar 8, 2010
    Messages:
    224
    Likes Received:
    80
    Occupation:
    Software Engineer
    Location:
    Dallas
    xXSebaSXx thanks buddy.

    I will try disabling AISEO and will do the custom coding in header.php (as you have mentioned its not too complicated :) )