1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Please help me with custom fields

Discussion in 'WordPress' started by Divvy, Sep 16, 2015.

  1. #1
    Hello guys,

    Maybe someone can help me...

    I have this line in my theme:
    <?php echo $post_external_link = (get_post_meta(get_the_ID(),'post_external_link',true))?'<a href="'.get_post_meta(get_the_ID(),'post_external_link',true).'">Click here to visit website</a>':'#'; ?>
    PHP:
    And I need to add this code:

    CODE1
    <?php echo $nofollow_tag; ?>
    PHP:
    CODE2
    <?php echo get_post_meta($post->ID, 'titletag', true); ?>
    PHP:
    To appear like this:
    Question1:
    Is the code2 well placed? I added '.get_post_meta($post->ID, 'titletag', true).'

    Question2:
    How can I add code1? I think will not work with '.nofollow_tag.' right?

    Can someone please help me?

    Thanks!!
     
    Divvy, Sep 16, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    This should work:
    
    <a href="'.get_post_meta(get_the_ID(),'post_external_link',true).'" '.$nofollow_tag.'>
    
    Code (markup):
     
    PoPSiCLe, Sep 16, 2015 IP
  3. Divvy

    Divvy Well-Known Member

    Messages:
    781
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #3
    Thank you for your reply and for trying to help me buddy, but unfortunately didn't worked :(
    I already tried that before without success...

    Any more ideas? :)
     
    Divvy, Sep 16, 2015 IP
  4. Divvy

    Divvy Well-Known Member

    Messages:
    781
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #4
    Fixed! Thank you bro :)
     
    Divvy, Sep 16, 2015 IP
  5. Divvy

    Divvy Well-Known Member

    Messages:
    781
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #5
    Btw.... I need another little help, if someone can help me I really appreciate :)

    I have this code:
    <?php echo $post_external_link = (get_post_meta(get_the_ID(),'post_external_link',true))?'<a href="'.get_post_meta(get_the_ID(),'post_external_link',true).'" '.$nofollow_tag.'>'.get_post_meta(get_the_ID(),'post_external_link',true).'</a>':'#'; ?>
    PHP:
    I want to display:
    '.get_post_meta(get_the_ID(),'post_external_link',true).'
    Code (markup):
    Or else:
    '.get_post_meta($post->ID, 'domaintag', true).'
    Code (markup):
    How I put in the code?
    I tried this but didn't worked:
    Can someone help me? Thanks! :)
     
    Divvy, Sep 16, 2015 IP