php - Shortcode with conditional tag to show different style -
i created short code displays content in 2 different pages.
both sites have different styles show same content of short code.
however, conditional tags not working properly.
here code:
function comunicacionpdf_sc($atts, $content = null) { extract(shortcode_atts(array("url" => 'http://www.example.com/file.pdf'), $atts)); if (is_page('comunicaciones')) { return 'test'; //$output .= '<h6><a href="'.$url.'" target="_blank">descargar pdf</a></h6>'; } else { //$output .= '<div class="cd_comunicacionespdf"><a href="'.$url.'" target="_blank">descargar aquí</a></div>'; return 'no-test'; } } add_shortcode('comunicacionpdf', 'comunicacionpdf_sc');
please ignore commented output, in frontend.
from already, thank help
Comments
Post a Comment