Hello in my wp admin i have a place to add download link which post an image and link to download site above videos here is the code: <?php if(get_post_meta(get_the_ID(), '_video_dvd_downurl',true)){?> <a href="<?php echo get_post_meta(get_the_ID(), '_video_dvd_downurl',true)?>" target="_blank"><div id="download"></div></a> PHP: How would i make it if i didnt add the link it would show a defult link? Cheers Tom
I used: <?php if(get_post_meta(get_the_ID(), '_video_dvd_downurl',true)){ <a href="<?php echo get_post_meta(get_the_ID(), '_video_dvd_downurl',true)?>" target="_blank"><div id="download"></div></a> else { echo "http :// defaultlink/download.html" target="_blank"><div id="download"></div></a>"; } ?> PHP: But i get Parse error: syntax error, unexpected '<' in /home/.puffball/free****uk/e2tv.tv/wp-content/themes/MovieSitePress/single.php on line 77 any help please
<a href="<?php if(get_post_meta(get_the_ID(), '_video_dvd_downurl',true)){ echo get_post_meta(get_the_ID(), '_video_dvd_downurl',true); else { echo 'http :// defaultlink/download.html'; } ?> " target="_blank"><div id="download"></div></a> PHP:
Hi plz try this code <?php if(get_post_meta(get_the_ID(), '_video_dvd_downurl',true)){ <a href="<?php echo get_post_meta(get_the_ID(), '_video_dvd_downurl',true)?>" target="_blank"><div id="download"></div></a> else { echo 'http :// defaultlink/download.html" target="_blank"><div id="download"></div></a>'; } ?> PHP:
This code should work: <?php if(get_post_meta(get_the_ID(), '_video_dvd_downurl',true)){?> <a href="<?php echo get_post_meta(get_the_ID(), '_video_dvd_downurl',true)?>" target="_blank"><div id="download"></div></a> <?php } else { ?> <a href="default_link.html" target="_blank"><div id="download"></div></a> <?php } ?> PHP: //edit: you did not post the ending if bracket in you original post so if there is more code that follows after that fir a href you new the take care of that
Does not work get Parse error: syntax error, unexpected T_ELSE in /home/.puffball/freeshituk/e2tv.tv/wp-content/themes/MovieSitePress/single.php on line 81 and that gets this error Parse error: syntax error, unexpected '<' in /home/.puffball/freeshituk/e2tv.tv/wp-content/themes/MovieSitePress/single.php on line 80
that gives Parse error: syntax error, unexpected '}' in /home/.puffball/freeshituk/e2tv.tv/wp-content/themes/MovieSitePress/single.php on line 86 <?php if(get_post_meta(get_the_ID(), '_video_dvd_downurl',true)){?> <a href="<?php echo get_post_meta(get_the_ID(), '_video_dvd_downurl',true)?>" target="_blank"><div id="download"></div></a> PHP: is the code atm
sorry my fault. This should work now <a href="<?php if(get_post_meta(get_the_ID(), '_video_dvd_downurl',true)){ echo get_post_meta(get_the_ID(), '_video_dvd_downurl',true); } else { echo 'http :// defaultlink/download.html'; } ?> " target="_blank"><div id="download"></div></a> PHP: