سلام
کدی که نوشتمو بررسی کنید. من میخواستم یک پست تایپ برای اسلایدر بالای سایتم بسازم و این مار رو هم کردم اما هر چی روی دکمه ادامه مطلبش کلیک میکنم یا دوباره ایندکس ریلود میشه یا پستای بخش نوشتهها رو نشونم میده. باید چه کاری انجام بدم؟
function my_function() {
$labels = array(
'name' => __( 'slideshow' ),
'singular_name' => __( 'slideshow' ),
'menu_name' => __( 'slideshow' ),
'name_admin_bar' => __( 'slideshow' ),
'add_new' => __( 'add picture ' ),
'add_new_item' => __( 'slideshow' ),
'new_item' => __( 'new post' ),
'edit_item' => __( 'edit post' ),
'view_item' => __( 'view post' ),
'all_items' => __( 'all picturs' ),
'search_items' => __( 'search' ),
'parent_item_colon' => __( 'parrent' ),
'not_found' => __( 'not found' ),
'not_found_in_trash' => __( 'not found in trash' )
);
$args = array(
'labels' => $labels,
'description' => __( 'carousel post type' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'carousel' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'custom-fields','permalink' ));
register_post_type( 'carousel', $args );
}
add_action( 'init', 'my_function' );
این هم کدی که در ایندکس قرار دادم
$slider = get_posts(array('post_type' => 'carousel', 'posts_per_page' => 3)); ?>
$count = 0; ?>
foreach ($slider as $slide) : ?>
<div class="carousel-item echo ($count == 0) ? 'active' : ''; ?>">
<img src=" echo wp_get_attachment_url(get_post_thumbnail_id($slide->ID));?>" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h3 class="text-right"> echo $post_title = $slide->post_title;?>h3>
<div class="text-right"> echo $post_excerpt = $slide->post_excerpt;?>div>
<div><a href=" echo $post_permalink = $slide->post_permalink;?>" class="btn btn-custom float-left" >ادامه مطلبa>div>
div>
div>
$count++; ?>
endforeach; ?>
مشکل بعدی هم اینه که اکسرپت رو هم نمیخونه از توابع من