OK. I am going to try to rewrite this.
I am trying to use the Gridly theme as a mobile only theme for my site.
The problem is the theme pulls all post categories into the main feed when it is formatted for mobile devices.
I only want readers to see posts in two categories on the main page, with the option to select other categories from the menu up top.
There is no front page php file.
The theme only includes the following:
404 Template (404.php)
Comments (comments.php)
Footer (footer.php)
Theme Functions (functions.php)
Header (header.php)
Main Index Template (index.php)
admin-menu-mark.php
admin-menu.php
Page Template (page.php)
Single Post (single.php)
Styles
Stylesheet (style.css)
So I modified the index.php
file to limit the post categories pulled into the homepage by writing query_posts( 'cat=79,120' )
above the start of the loop ( above: <?php if (have_posts()) : ?>
).
Doing so limits the main page to those two categories, but also does the same when I click on other categories in the menu. Since it is outside the loop it seems to be overwriting the rest of the rules (?).
Here is the code as is: (This is taken from the index file)
<?php get_header(); ?>
<?php if (have_posts()) : ?>
<div id="post-area">
<?php while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( has_post_thumbnail() ) { ?>
<div class="gridly-image"><a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'summary-image' ); ?></a></div>
<div class="gridly-category"><p><?php the_category(', ') ?></p></div>
<?php } ?>
<div class="gridly-copy"><h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<p class="gridly-date"><?php the_time(get_option('date_format')); ?> </p>
<?php the_excerpt(); ?>
<p class="gridly-link"><a href="<?php the_permalink() ?>"></a></p>
</div>
</div>
<?php endwhile; ?>
</div>
<?php else : ?>
<?php endif; ?>
<?php next_posts_link('<p class="view-older">View Older Entries</p>') ?>
<?php get_footer(); ?>
Does anyone have any idea how I could only include two categories in the homepage feed without overwriting the rules for the rest of the site?
query_posts
?index.php
file only, and yet you thereby changed the content of pages then there's something off with your theme. Or what did you mean by did the same thing on every other page?front-page.php
. But once again, please reword the question, and then I might provide you with an actual answer.