Advertisement
Guest User

Add urls

a guest
Mar 26th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. add_action('admin_menu', 'campos_fuentes');  
  4. function campos_fuentes() {
  5.         add_meta_box('aniadirfuntes','Fuentes','func_camp_fuentes','post','normal','high');
  6. }
  7.  
  8. global $wpdb, $post;
  9.  
  10. function func_camp_fuentes() {
  11.         $value1  = (get_post_meta($post->ID, aniadirfuntes, true));        
  12.         echo '<input type="text" name="fuente[]" id="aniadirfuntes" value="'.htmlspecialchars($value1).'" style="width: 200px;" />';                        
  13. }
  14.  
  15.  
  16. function aniadirfuentes(){ 
  17.        $fuente=$_POST['fuente'];
  18.                          
  19.        foreach($fuente as $url ) {          
  20.            $salidaenlace=parse_Url($url, PHP_URL_HOST);
  21.            print '<a href='.$url .'>'.ucfirst($salidaenlace).'</a>';  
  22.            echo ", ";
  23.            
  24.        }                              
  25. }
  26.  
  27. add_filter ('the_content', 'aniadirfuentes');
  28.                                                
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement