Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/03/2012, 19:55
naked
 
Fecha de Ingreso: marzo-2009
Mensajes: 71
Antigüedad: 15 años, 1 mes
Puntos: 0
Añadir contenido a the_content

Buenas,

Estoy tratando de crear un simple plugin que añada una lineas de contenido a the_content pero algo no me funciona. Las lineas la escribo desde una caja en el Admin que he creado y estas deberían aparecer al final del contenido del post.

Código PHP:
<?php

Plugin Name
xxxx
Plugin URI
xxx
Description
xxx
Version
1.0
Author
xxx
Author URI
xxx
License
xxx

add_action
('admin_menu''campos_fuentes');  
     function 
campos_fuentes() {
        
add_meta_box('aniadirfuntes','Fuentes','func_camp_fuentes','post','normal','high');
}

global 
$wpdb$post;

function 
func_camp_fuentes() {
     
$value1  = (get_post_meta($post->IDaniadirfuntestrue)); 
       
     echo 
'<div class="caja_admin_fuentes">
                                                             
                   <input type="text" name="fuente[]" id="aniadirfuntes" value="'
.htmlspecialchars($value1).'" style="width: 200px;" />
                                                       
               </div>'
;
                          
}


function 
aniadirfuentes(){
    
   
$fuente=$_POST['fuente']; 
                         
    foreach(
$fuente as $url ) {
           
           
$salidaenlace=parse_Url($urlPHP_URL_HOST); 
           print 
'<a href='.$url .'>'.$salidaenlace.'</a>';
           echo 
", ";              
     }
           
                               
}

add_filter ('the_content''aniadirfuentes');   
                                                
?>
Un saludo.