Nu glaub mir doch mal, was ich dir vorlüge,
Habe den Quellcode mal aufgehübscht
add_action('init', 'cptui_register_my_cpt_anime');
function cptui_register_my_cpt_anime() {
register_post_type( 'anime',
array( 'label' => 'anime',
'description' => ”,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_icon' => 'dashicons-book',
'capability_type' => 'post',
'map_meta_cap' => true,
'hierarchical' => false,
'rewrite' => array('slug' => 'anime',
'with_front' => true
),
'query_var' => true,
'supports' => array('title',
'editor',
'custom-fields',
'revisions',
'thumbnail',
'author',
'post-formats',
'categories'
),
'labels' => array ('name' => 'Anime List',
'singular_name' => 'Series List',
'menu_name' => 'Anime List',
'add_new' => 'Add Anime',
'add_new_item' => 'Add New Anime',
'edit' => 'Edit',
'edit_item' => 'Edit Anime',
'new_item' => 'New Anime',
'view' => 'View Anime',
'view_item' => 'View Anime',
'search_items' => 'Search Anime',
'not_found' => 'No Anime Found',
'not_found_in_trash' => 'No Anime Found in Trash',
'parent' => 'Parent Anime',
),
'public' => true,
'has_archive' => true,
)
);
}
Alles anzeigen
So vielen Dank dafür, dass du dir diese Mühe gemacht hast. Jedoch geht es trotzdem nicht, ich glaube dieses tutorial(http://newsinfo.me/how-to-make-anime-list-in-wordpress/) funktioniert einfach nicht :D. Ich schicke mal die anderen Codes vielleicht haben wir hier ein Wordpress Experten der daraus lesen kann wo ich meine Fehler mache oders wo das Tutorial fehlerhaft ist.
1. Code :
[COLOR=#000000]<?php[/COLOR]
/*
Template Name: Anime List
*/
get_header();
?>
<style>
.a-z li a{color:#333}.a-z li{list-style:initial;margin-left:15px;float:left;line-height:21px;width:47%}.a-z li a:hover{text-decoration:underline}.anime-list2{margin-top:10px}.letter-cell{display:block;border-bottom:4px solid #3a3939;padding-bottom:5px;margin:10px 0;font-weight:600;font-size:14px;clear:both}
@media only screen and ( max-width: 645px ) {.a-z li{margin-left:0;float:none;width:auto}}</style>
<div id="content">
<div class="postsbody">
<div class="ctn">
<h1 class="ttl"><?php the_title(); ?></h1>
<ul class="genres">
<?php
$terms = get_terms('genre');
if ( !empty( $terms ) && !is_wp_error( $terms ) ){
echo '';
foreach ( $terms as $term ) {
$term = sanitize_term( $term, 'genre' );
$term_link = get_term_link( $term, 'genre' );
echo '<li><a href="' . esc_url( $term_link ) . '">' . $term->name . ' (' . $term->count . ')' . '</a></li>';
}
echo '';
}
?>
</ul><div class="nav_apb"><a href="#A">A</a><a href="#B">B</a><a href="#C">C</a><a href="#D">D</a><a href="#E">E</a><a href="#F">F</a><a href="#G">G</a><a href="#H">H</a><a href="#I">I</a><a href="#J">J</a><a href="#K">K</a><a href="#L">L</a><a href="#M">M</a><a href="#N">N</a><a href="#O">O</a><a href="#P">P</a><a href="#Q">Q</a><a href="#R">R</a><a href="#S">S</a><a href="#T">T</a><a href="#U">U</a><a href="#V">V</a><a href="#W">W</a><a href="#X">X</a><a href="#Y">Y</a><a href="#Z">Z</a>
</div><div class="clear"></div>
<div class="anime-list2">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array (
'posts_per_page' => 1000,
'post_type' => 'anime',
'orderby' => 'title',
'order' => 'ASC',
'paged' => $paged,
);
query_posts($args);
if ( have_posts() ) {
$in_this_row = 0;
while ( have_posts() ) {
the_post();
$first_letter = strtoupper(substr(apply_filters('the_title',$post->post_title),0,1));
if ($first_letter != $curr_letter) {
if (++$post_count > 1) {
end_prev_letter();
}
start_new_letter($first_letter);
$curr_letter = $first_letter;
}
if (++$in_this_row > $posts_per_row) {
end_prev_row();
start_new_row();
++$in_this_row; // Account for this first post
} ?>
<div class="a-z"><li><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li></div>
<?php }
end_prev_letter();
?>
<?php } else {
echo "<h2>Maaf tidak ada post.</h2>";
}
?>
</div>
</div>
</div>
<?php get_template_part('sidebar_right'); ?>
<div class="clear"></div>
<?php
get_footer();
?>
<?php
function end_prev_letter() {
end_prev_row();
echo "</div><!-- End of letter-group -->\n";
}
function start_new_letter($letter) {
echo "<div class='letter-group'>\n";
echo "\t<div class='letter-cell'><a name='$letter'>$letter</a></div>\n";
start_new_row($letter);
}
function end_prev_row() {
echo "\t</div><!-- End row-cells -->\n";
}
function start_new_row() {
global $in_this_row;
$in_this_row = 0;
echo "\t<div class='row-cells'>\n";
}
[COLOR=#000000]?>[/COLOR]
Alles anzeigen
2. Code :
[COLOR=#000000]<?php get_header(); ?>[/COLOR]
<div id="content">
<div class="postsbody">
<div class="ctn">
<h1><?php the_title(); ?></h1>
<?php if ( function_exists('yoast_breadcrumb') )
{yoast_breadcrumb('<p id="breadcrumbs">','</p>');} ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php wpb_set_post_views(get_the_ID()); wpb_get_post_views(get_the_ID()); ?>
<!--Anime info -->
<div class="sn"><?php if ( has_post_thumbnail() ) { the_post_thumbnail(); }?>
<div class="sinopsis"><p><?php the_content(); ?></p>
</div>
</div>
<div class="anf">
<span><b>Native Title</b>: <?php $meta = get_post_meta( get_the_ID(), 'smoke_nativez', true ); echo $meta; ?></span>
<span><b>Tipe</b>: <?php $meta = get_post_meta( get_the_ID(), 'smoke_type', true ); echo $meta; ?></span>
<span><b>Status</b>: <?php $meta = get_post_meta( get_the_ID(), 'smoke_status', true ); echo $meta; ?></span>
<span><b>Score</b>: <?php $meta = get_post_meta( get_the_ID(), 'smoke_rate', true ); echo $meta; ?></span>
<span><b>Produser</b>: <?php $meta = get_post_meta( get_the_ID(), 'smoke_author', true ); echo $meta; ?></span>
<span><?php echo get_the_term_list( $post->ID, 'genre', '<b>Genre</b>: ', ', ', '' ); ?></span>
</div>
<!--Episode-->
<div class="epl">
<h3>Nonton Episode <?php the_title(); ?> Subtitle Indonesia</h3>
<ul>
<?php $chap = get_the_ID($post->ID, "anime", true); ?>
<?php
$cukchap = new WP_Query(array(
'showposts' => '1000',
'post_type' => 'post',
'meta_key' => 'smoker_episode',
'orderby' => 'date',
'meta_key' => 'smoke_series',
'meta_value' => $chap
));
?>
<?php
while ($cukchap->have_posts()):
$cukchap->the_post();
?>
<li>
<span class="t1"><?php $meta = get_post_meta( get_the_ID(), 'smoker_episode', true ); if($meta) { ?> <?php echo $meta; ?><?php } ?> <?php $meta = get_post_meta( get_the_ID(), 'smoke_tambahan', true ); if($meta) { ?>- <?php echo $meta; ?><?php } ?>
<span class="t2"><a href="<?php the_permalink(); ?>" target="_blank">
Watch Now</a></span>
<?php
endwhile;
?>
</li>
</ul>
</div>
<?php endwhile; endif; ?>
<div id="disqus-comments">
<div id="disqus_thread"></div>
</div>
<script>
var disqus_config = function () {
this.page.url = '<?php echo get_permalink(); ?>';
};
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</div>
<?php get_template_part('sidebar_right'); ?>
</div>
[COLOR=#000000]<?php get_footer(); ?>[/COLOR]
Alles anzeigen
3. UNd das ist der dritte Code den ich in functions.php einfügen soll (den Bandit überarbeitet hat) :
[COLOR=#0000BB][FONT=monospace]add_action[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'init'[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'cptui_register_my_cpt_anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]);
function [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]cptui_register_my_cpt_anime[/FONT][/COLOR][COLOR=#007700][FONT=monospace]() {
[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]register_post_type[/FONT][/COLOR][COLOR=#007700][FONT=monospace]( [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
array( [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'label' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'description' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> &[/FONT][/COLOR][COLOR=#FF8000][FONT=monospace]#8221;,
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'public' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]true[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'show_ui' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]true[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'show_in_menu' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]true[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'menu_icon' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'dashicons-book'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'capability_type' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'post'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'map_meta_cap' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]true[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'hierarchical' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]false[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'rewrite' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> array([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'slug' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'with_front' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]true
[/FONT][/COLOR][COLOR=#007700][FONT=monospace]),
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'query_var' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]true[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'supports' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> array([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'title'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'editor'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'custom-fields'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'revisions'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'thumbnail'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'author'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'post-formats'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'categories'
[/FONT][/COLOR][COLOR=#007700][FONT=monospace]),
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'labels' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> array ([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'name' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Anime List'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'singular_name' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Series List'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'menu_name' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Anime List'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'add_new' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Add Anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'add_new_item' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Add New Anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'edit' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Edit'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'edit_item' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Edit Anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'new_item' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'New Anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'view' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'View Anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'view_item' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'View Anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'search_items' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Search Anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'not_found' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'No Anime Found'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'not_found_in_trash' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'No Anime Found in Trash'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'parent' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'Parent Anime'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
),
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'public' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]true[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'has_archive' [/FONT][/COLOR][COLOR=#007700][FONT=monospace]=> [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]true[/FONT][/COLOR][COLOR=#007700][FONT=monospace],
)
);
} [/FONT][/COLOR]
Alles anzeigen