Friday 15 July 2011

wordpress - Use value inside another PHP function -



wordpress - Use value inside another PHP function -

in wordpress i'm using function plugin <?php the_field('event_boat'); ?> output post id selected field, happens 5755 in example.

as plugin allows me output post id possible incorporate value function within <?php echo get_permalink(); ?> permalink based on post id?

you can pass id parameter in get_permalink function, either storing id value in new variable, or passing in acf-function straight parameter.

$post_id = get_field('event_boat'); echo get_permalink($post_id) // echoes out link id 5755

i'm using get_field() instead of the_field() because the_field() echo out value, want pass along. might aswell do:

echo get_permalink(get_field('event_boat'));

php wordpress

No comments:

Post a Comment