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&iacute;</a></div>';             return 'no-test';         }     }     add_shortcode('comunicacionpdf', 'comunicacionpdf_sc'); 

please ignore commented output, in frontend.

from already, thank help


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -