• 03-02-2013, 18:13:28
    #1
    resimdeki gibi post eklerken ve post eklendikten sonra bir menü eklemek istiyorum bazı işlemler için nasıl bir fonksiyon eklemeliyim ?

  • 04-02-2013, 14:10:32
    #2
    koca sitede bunu cevaplayacak kimse yok mu :S
  • 04-02-2013, 14:43:10
    #3
    Kurumsal PLUS
    Örnek eklentideki kodları incelemeyi denediniz mi?
  • 04-02-2013, 15:35:40
    #4
    Aşağdaki fonksiyonlar işinizi görecektir
    <?php
    add_action( 'add_meta_boxes', 'meta_box_ekle' );  
    function meta_box_ekle()  
    {  
        add_meta_box( 'milat-id', 'Milat Bilgilerim', 'milatkisim', 'post', 'normal', 'high' );  
    }  
    
    
    function milatkisim()  
    {  
      global $post;  
    	$post_id 	= $post->ID ;
        $aciklama 	= get_post_meta($post_id, 'aciklama', true);
        wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' ); 
    	
        ?> 
    	<table> 
    <tr> 
            <td width="250px"><label for="aciklama">Açıklama</label> </td>
             <td ><textarea name="aciklama" id="aciklama" rows="4" cols="103"><?php echo $aciklama; ?></textarea></td>
        </tr>	
    	
         </table>
     
        <?php  
    } 
    
    
    
    add_action( 'save_post', 'milatkayit' );  
    function milatkayit( $post_id )  
    {  
        if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; 
        if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return; 
        if( !current_user_can( 'edit_post' ) ) return;  
        if( isset( $_POST['aciklama'] ) )  
            update_post_meta( $post_id, 'aciklama',  $_POST['aciklama'] );  
    	 
    }
  • 04-02-2013, 18:27:01
    #5
    By_MiLaT adlı üyeden alıntı: mesajı görüntüle
    Aşağdaki fonksiyonlar işinizi görecektir
    teşekkür ederim