Skip to content
WJunction - Webmaster Forum

Please help me with custom fields

Status
Not open for further replies.
Hello guys,

Maybe someone can help me...

I have this line in my theme:
PHP:
<?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>':'#'; ?>

And I need to add this code:

CODE1
PHP:
<?php echo $nofollow_tag; ?>

CODE2
PHP:
<?php echo get_post_meta($post->ID, 'titletag', true); ?>

To appear like this:
<?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).'" '.get_post_meta($post->ID, 'titletag', true).' CODE1>Click here to visit website</a>':'#'; ?>

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!!
 
Last edited:

2 comments

Code:
[COLOR=#0000BB][FONT=monospace]<?php [/FONT][/COLOR][COLOR=#007700][FONT=monospace]echo [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$post_external_link [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= ([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]get_post_meta[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]get_the_ID[/FONT][/COLOR][COLOR=#007700][FONT=monospace](),[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'post_external_link'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]true[/FONT][/COLOR][COLOR=#007700][FONT=monospace])) ? 
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'<a href="' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]. [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]get_post_meta[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]get_the_ID[/FONT][/COLOR][COLOR=#007700][FONT=monospace](),[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'post_external_link'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]true[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) . '[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]" ' [/FONT][/COLOR]. get_post_meta($post->ID, 'titletag', true)  . '[COLOR=#007700][FONT=monospace] rel="' . [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]$nofollow_tag [/FONT][/COLOR][COLOR=#007700][FONT=monospace]. [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'">Click here to visit website</a>' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]: [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'#'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]; [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]?>[/FONT][/COLOR]

Assuming $nofollow_tag ="nofollow"
 
Last edited:
Status
Not open for further replies.

About the author

D
Active Member · Joined
806
Messages
18
Reactions
18
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom