Page
-
Hello,
Can someone give me a code to have a specific page show a specific category only (cat id=35)
thanks
-
Make a template for that page, and use this code in the loop part.
Create a page, and in the attributes, select that template.<?php if(have_posts()) : ?> <?php if (is_page()) { query_posts('cat=35'); } ?> <?php while(have_posts()) : the_post(); ?>
thanks so much
i get this error message
Parse error: syntax error, unexpected $end in /home/behealthy/rawunfiltered.com/wp-content/themes/arthemia-premium/Blog.php on line 43
this is the template i made
<?php
/*
Template Name: blog
*/
?><?php get_header(); ?>
<div id=”content” class=”archive”>
<?php if(have_posts()) : ?>
<?php
if (is_page()) {
query_posts(‘cat=35’);
}
?><?php while(have_posts()) : the_post(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class=”post” id=”post_<?php the_ID(); ?>”>
<span id=”map”>/”>Home » <?php the_title(); ?></span>
<h2 class=”title”><?php the_title(); ?></h2>
<div class=”entry” style=”padding-top:15px;”>
<?php the_content(‘<p class=”serif”>Read the rest of this page »</p>’); ?><?php wp_link_pages(array(‘before’ => ‘<p>Pages: ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>
</div>
</div>
<?php endwhile; endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>Review the WordPress loop structure and reduce your if (have_posts()) and while (have_posts()) to one each.
Im not sure what you mean…i a newbie…
i did some changing and still get the error:
Parse error: syntax error, unexpected $end in /home/behealthy/rawunfiltered.com/wp-content/themes/arthemia-premium/Blog.php on line 29<?php
/*
Template Name: blog
*/
?><?php get_header(); ?>
<div id=”content” class=”archive”>
<?php if(have_posts()) : ?>
<?php
if (is_page()) {
query_posts(‘cat=35’);
}
?><span id=”map”>/”>Home » <?php the_title(); ?></span>
<h2 class=”title”><?php the_title(); ?></h2>
<div class=”entry” style=”padding-top:15px;”>
<?php the_content(‘<p class=”serif”>Read the rest of this page »</p>’); ?><?php wp_link_pages(array(‘before’ => ‘<p>Pages: ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>I can’t download the premium theme, so I can’t look at the files.
In the “blog template”, replace the entire loop part. That is, between
<div id="content">
and<div class="post" id="post_<?php the_ID(); ?>">
See if that works.
‘<div id=”content” class=”archive”>
<?php if(have_posts()) : ?>
<?php
if (is_page()) {
query_posts(‘cat=35’);
}
?><?php while(have_posts()) : the_post(); ?>
<div class=”post” id=”post_<?php the_ID(); ?>”>`
its giving me a line 23 error. line 23 is <?php get_footer(); ?>
im not sure whyps. cool website buddah
There is something that looks odd here
<span id="map">/">Home » <?php the_title(); ?></span>
It looks like a double closing tag, something is missing…try
<span id="map">Home » <?php the_title(); ?></span>
or double check the code that you copied and pasted into the template.
ps: thanks!
Did the above changes and checked the code I pasted….not sure why it keeps mentioning the last line error….
I guess I’ll have to keep fiddling around till i get it…but thanks for your help 🙂
- The topic ‘Page’ is closed to new replies.