November 17, 201214 yr hello all wondered if you could help me figue out why the code below isn't working? I have 'buy_now' set up as a Custom Field in Wordpress. <p><b>FIND OUT MORE </b><a href="<?php the_field('buy_online'); ?>" TARGET="_blank">HERE</a></p> apologies if this is in the wrong forum section cheers for any help eighty0ne
November 17, 201214 yr I dont know anything about wordpress but maybe that function only returns a value, so you have to echo it out. <p><b>FIND OUT MORE </b><a href="<?php echo the_field('buy_online'); ?>" TARGET="_blank">HERE</a></p>
November 17, 201214 yr Author thanks Jock - just tried that but no luck sadly it just seems to want to create a link to the current page here is one of the pages in question the full code for that section runs <p><?php the_field('in_a_nutshell'); ?></p> <p><?php the_field('materials'); ?></p> <p><?php the_field('price'); ?></p> <p><?php the_field('in_their_words'); ?></p> <p><b>FIND OUT MORE </b><a href="<?php echo the_field('buy_online'); ?>" TARGET="_blank">HERE</a></p> weird - anyone else any ideas? cheers
November 18, 201214 yr Er, the OP has just said that echoing out the function result didn't work. A shorthand way of echoing out a statement won't suddenly make it work lol. @OP: does the field "buy_online" actually exist? I'd say no if other calls to the get_field function work as expected. Edited November 18, 201214 yr by webdesigner93
Create an account or sign in to comment