Custom Post Type Trouble

you likely need to do a flush re-write. go to settings/permalinks in the dashboard and click save. You’ll be good to go. In the future you can add this directly to your CPT plugin. I would suggest getting a bit more creative with your naming though so you don’t have conflicts later.

Wrap div-tag around posts in page

What happen if you proceed with the following syntax? <div id=”container”> <?php if( have_posts() ) : while( have_posts() ) : the_post(); ?> <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> <h2 class=”entry-title”><?php the_title(); ?></h2> <div class=”entry-content”> <?php the_content(); ?> </div> </article > <!– /#post-<?php the_post_ID(); ?> –> <?php endwhile; endif; ?> </div> <!– /#container –> The … Read more

Show stuff everywhere except single post?

The is_single is WordPress function so you should add parentheses after it as displayed in the following correct code. <?php if ( ! is_single() ){ ?> <meta property=”og:image” content=”<?php echo get_template_directory_uri(); ?>/images/image.png”/> <?php } ?>

single.php not pulling in any data from database

have_posts() needs a WordPress database query before it will show anything, check it here like this: $the_query = new WP_Query( ‘post_type=post’ ); if ( $the_query->have_posts() ) { echo ‘<ul>’; while ( $the_query->have_posts() ) { $the_query->the_post(); echo ‘<li>’ . get_the_title() . ‘</li>’; } echo ‘</ul>’; } else { // no posts found } it will display … Read more

Different post into a single page

Add the below code in your single.php file <div class=”post-contents”> <?php $args = array( ‘posts_per_page’ => -1,’orderby’=> ‘date’,’order’=> ‘DESC’,’post_type’ => ‘post’,’post_status’=> ‘publish’); $myposts = get_posts( $args ); foreach ( $myposts as $post ) : setup_postdata( $post ); ?> <div class=”post-single”> <a href=”https://wordpress.stackexchange.com/questions/193620/<?php the_permalink(); ?>”><?php the_title(); ?></a> <p><?php echo $post->post_content; ?></p> </div> <?php endforeach; wp_reset_postdata();?> </div>