milardovich

Shortcode problem in Wordpress

May 11th, 2011
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. function show_wpdf_dir($atts,$content = null){
  2.     echo 'test';
  3. }
  4. function show_auto_pdf_dir($content){
  5.     $postid = get_the_id();
  6.     $check = get_post_custom_values('wp-pdf-dir', $postid);
  7.     if(!empty($check[0]) && $check[0] !== '000000' && is_page()){
  8.         $month = substr($check[0],0,2);
  9.         $year = substr($check[0],2,7);
  10.         echo $content.show_wpdf_archive($year,$month);
  11.     } else {
  12.         echo $content;
  13.     }
  14. }
  15. add_filter('the_content', 'show_auto_pdf_dir');
  16. add_shortcode( 'wp-pdf-dir', 'show_wpdf_dir' );
Advertisement
Add Comment
Please, Sign In to add comment