• 01-09-2017, 15:52:25
    #1
    Selamlar, wordpress de özel yazı ekleme sayfası yapmaya çalışıyorum. Dizi ve Filmleri ayrı sayfalarda ekleyeceğim.

    Aşağıdaki kod ile sayfayı ekledim;

    add_action( 'init', 'custom_post_type_film', 0 );
    function custom_post_type_film() {
    $labels = array(
    'name' => _x( 'Filmler', 'Yazı Türü Genel İsmi' ),
    'singular_name' => _x( 'Film', 'Yazı Türü Tekil İsmi' ),
    'menu_name' => __( 'Film Ekle' ),
    'parent_item_colon' => __( 'Ana Film' ),
    'all_items' => __( 'Tüm Filmler' ),
    'view_item' => __( 'Filmi Görüntüle' ),
    'add_new_item' => __( 'Yeni Film Ekle' ),
    'add_new' => __( 'Yeni Ekle' ),
    'edit_item' => __( 'Filmi Düzenle' ),
    'update_item' => __( 'Filmi Güncelle' ),
    'search_items' => __( 'Film Ara' ),
    'not_found' => __( 'Bulunamadı' ),
    'not_found_in_trash' => __( 'Çöp kutusunda bulunamadı.' ),
    );
    $args = array(
    'label' => __( 'film' ),
    'description' => __( 'Tüm güncel filmler bir arada' ),
    'labels' => $labels,
    'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
    'hierarchical' => false,
    'public' => true,
    'show_ui' => true,
    'show_in_menu' => true,
    'show_in_nav_menus' => true,
    'show_in_admin_bar' => true,
    'menu_position' => 5,
    'can_export' => true,
    'has_archive' => true,
    'exclude_from_search' => false,
    'publicly_queryable' => true,
    'capability_type' => 'page',
    );
    register_post_type( 'film', $args );
    
    
    
    }

    single-film.php de aşağıdaki kodlarla yazıyı çağırmaktayım;


    <?php
    // post_type ile içerik tipini belirtiyoruz
    // post_per_page ile görüntülenecek içerik sayısını belirtiyoruz
    $args = array( 'post_type' => 'film', 'posts_per_page' => 10 );
    $the_query = new WP_Query( $args );
    ?>
    <?php if ( $the_query->have_posts() ) : ?>
    <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <div class="entry-content">
    <?php the_content(); ?>
    </div>
    <?php wp_reset_postdata(); ?>
    <?php else: ?>
    <p><?php _e( 'Üzgünüz, aradığınız içerik bulunamadı.' ); ?></p>
    <?php endif; ?>
    Fakat aşağıdaki hatayı alıyorum;



    Arkadaşlar acaba yanlış mı çağırıyorum yazıyı?
  • 03-09-2017, 16:50:11
    #2
    Güncel sorun