abighill
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Prevent Multiplying PostsOK – my fault. My code was wrong.
I had used the loop inside itself. Not clever.
<?php
/*
Template Name: New Home
*/
?>
<?php get_header(); ?>
<?php get_sidebar(); ?>
<div id="maincontent">
<!-- Home Template -->
<?php if (have_posts()) : while(have_posts()) : the_post(); ?><div class="post">
<h3><?php the_title(); ?></h3>
<div class="thecontent">
<?php the_content(''); ?>
</div>
</div><?php endwhile; endif; ?>
<?php query_posts('cat=1'); ?>
<?php if (have_posts()) : while(have_posts()) : the_post(); ?>
<div class="post">
<h2><?php the_date(); ?></h2>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="thecontent">
<?php the_excerpt(); ?>
</div>
</div>
<?php endwhile; endif; ?></div>
</div>
<?php get_footer(); ?>Forum: Fixing WordPress
In reply to: Single Category on Front Page with IntroductionCorrection: this is not resolved.
See here: https://www.ads-software.com/support/topic/89624
For some reason it is mulitplying the posting category by the number of posts.
Forum: Fixing WordPress
In reply to: Single Category on Front Page with IntroductionSorted. Not sure if this couldn’t have been done in a more elegant more way but this seems to have solved my issue.
———————————-
<?php
/*
Template Name: New Home
*/
?><?php get_header(); ?>
<?php get_sidebar(); ?><div id="maincontent">
<!-- Home Template -->
<?php if (have_posts()) : while(have_posts()) : the_post(); ?><div class="post">
<h3><?php the_title(); ?></h3>
<div class="thecontent">
<?php the_content(''); ?>
</div>
</div><?php endwhile; endif; ?>
<?php query_posts('cat=1'); ?>
<?php if (have_posts()) : while(have_posts()) : the_post(); ?><?php $my_query = new WP_Query('category_name=news');
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID; ?>
<div class="post">
<h2><?php the_date(); ?></h2>
<h3><a>"><?php the_title(); ?></a></h3>
<div class="thecontent">
<?php the_excerpt(); ?>
</div>
</div>
<?php endwhile; ?><?php endwhile; endif; ?>
</div>
</div>
<?php get_footer(); ?>
———————————-
1.) This template page has been named home.php.
2.) Where there is a category with the slug ‘news’ and category ID = 1.
3.) Static Page plugin is installed as suggested.
Thanks
Forum: Fixing WordPress
In reply to: Single Category on Front Page with IntroductionI am already using this plugin but it doesn’t allow you to combine both the introduction and posts on the same page. Or am I missing something?