bir türlü çözemedim sabahtan beri kafayı yicem :S
ben temama şu kodlarla;
add_action('init', 'post_type_portfolio');
add_action('init', 'post_type_portfolio');
function post_type_portfolio() {
register_post_type( 'Portfolio', array(
'label' => __('Portfolio'),
'public' => true,
'show_ui' => true,
'_builtin' => false, // It's a custom post type, not built in
'_edit_link' => 'post.php?post=%d',
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array("slug" => "urun"), // Permalinks
'query_var' => "portfolio",
'menu_position' => 20,
'supports' => array('title', 'excerpt', 'editor', 'thumbnail',),
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes' ),
'taxonomies' => array( 'category', 'post_tag', 'page-category' ),
));
// add the following function if you are getting
// a 'Page not found' error from your permalink
flush_rewrite_rules( false );
}
custom type özelliği ekledim yani normal yazı girişinin yanı sıra ekstra bir ayzı girişi daha yaptım.
bu ekstra yazılarıda şu kodlarla ana sayfamda görüntülüyorum.
<?php
global $post;
$myposts = get_posts(array(
'post_type' => 'portfolio',
'numberposts' => '999',
'orderby' => 'menu_order',
'order' => 'ASC'
));
foreach($myposts as $post):
?>
<?php setup_postdata($post) ?>
<div class="tekilurun">
<div class="demobas"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></div>
</br><div class="demoimg"><center><img alt="<?php the_title(); ?> " src="<?php echo get_post_meta($post->ID, "demo", true); ?>" ></center></div>
<center><?php the_post_thumbnail(); ?></center>
<div class="fiyatdem"><?php echo get_post_meta($post->ID, "fiyatdem", true); ?></div></div>
<?php endforeach; wp_reset_query(); ?> </div>
ana sayfamda düzgünce görüntüledim bu eklediğim yazıalrı hocam fakat temamda arama yapıldığı zaman bu ekstradan eklediğim yazılar yani custom yazılar sabit bir şekilde yukarıda duruyor. arama sonuçlarından bu custom yazıları nasıl kaldırabilirim ?
custom post type sorunu
0
●223