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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -