Easy for clever people! 2 loops at the same page!
-
Hello People!
I have this loop in my home.php file, and it works fine!
But now i really want a loop more, there use a custom post type, as i have created with the plugin: “Custom Content Type Manager”
My problem is now, that i can’t figur out how to let my loop use the custom post type, and now the normal one!
my new custom post type have the name: single-detgamle.php And the code is this:
<?php
/**
* Sample template for displaying single detgamlevig posts.
* Save this file as as single-detgamlevig.php in your current theme.
*
* This sample code was based off of the Starkers Baseline theme: https://starkerstheme.com/
*/get_header(); ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<?php the_author(); ?>
<?php the_excerpt(); ?><h2>Custom Fields</h2>
<!– You have not associated any custom fields with this post-type. Be sure to add any desired custom fields to this post-type by clicking on the “Manage Custom Fields” link under the Custom Content Type menu and checking the fields that you want. –>
<?php endwhile; // end of the loop. ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>My working loop look like this!
————————————————————————–
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( ‘content’, ‘home’ ); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || ‘0’ != get_comments_number() )
comments_template();
?><?php endwhile; // end of the loop. ?>
- The topic ‘Easy for clever people! 2 loops at the same page!’ is closed to new replies.