Page of Posts in carrington

17 views
Skip to first unread message

clayd

unread,
Apr 7, 2010, 6:37:36 PM4/7/10
to Carrington CMS Theme Framework for WordPress
I am trying to create a Page of Post from a single category. I am
looking at the codex for this and do not see how to make it work with
the carrington theme. Can someone please help?

Clay

Extra info:
Link to Page of Posts on codex: http://codex.wordpress.org/Pages#A_Page_of_Posts

Custom Page template code: (Please do not laugh to hard at my
attempt, well ok laugh)

<?php
/*
Template Name: posts_cat
*/
?>
<?php

// This file is part of the Carrington Blog Theme for WordPress
// http://carringtontheme.com
//
// Copyright (c) 2008-2009 Crowd Favorite, Ltd. All rights reserved.
// http://crowdfavorite.com
//
// Released under the GPL license
// http://www.opensource.org/licenses/gpl-license.php
//
//
**********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
**********************************************************************

if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die(); }
if (CFCT_DEBUG) { cfct_banner(__FILE__); }

get_header();
get_sidebar();
?>

<div id="post-content-<?php the_ID() ?>" <?php post_class('full'); ?>>

<?php
if (is_page() ) {
$category = get_post_meta($posts[0]->ID, 'references', true);
}
if ($category) {
$cat = get_cat_ID($category);
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$post_per_page = 4; // -1 shows all posts
$do_not_show_stickies = 1; // 0 to show stickies
$args=array(
'category__in' => array($cat),
'orderby' => 'date',
'order' => 'DESC',
'paged' => $paged,
'posts_per_page' => $post_per_page,
'caller_get_posts' => $do_not_show_stickies
);
$temp = $wp_query; // assign orginal query to temp variable for
later use
$wp_query = null;
$wp_query = new WP_Query($args);
if( have_posts() ) :
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div id="post-content-<?php the_ID() ?>" <?php
post_class('full'); ?>>
<h1 class="entry-title full-title"><?php the_title() ?></h1>
<div class="entry-content full-content">
<?php
the_content('<span class="more-link">'.__('Continued...',
'carrington-blog').'</span>');
$args = array(
'before' => '<p class="pages-link">'. __('Pages: ', 'carrington-
blog'),
'after' => "</p>\n",
'next_or_number' => 'number'
);
wp_link_pages($args);
?>
<div class="clear"></div>
</div><!--/entry-content-->


<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Older Entries') ?
></div>
<div class="alignright"><?php previous_posts_link('Newer Entries
»') ?></div>
</div>
<?php else : ?>

<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that
isn't here.</p>
<?php get_search_form(); ?>

<?php endif;

$wp_query = $temp; //reset back to original query

} // if ($category)
?>

</div>


<?php

get_footer();

?>

Kai Pan

unread,
Apr 7, 2010, 11:28:39 PM4/7/10
to carrington...@googlegroups.com
Hm, is there a specific reason you want to use a page to replicate the category archive function? Why not just call the category archive? Is it for URL shortness or something? Even then, you can just use a redirect like Page Links To plugin to accomplish the same thing.



--
To unsubscribe, reply using "remove me" as the subject.

clayd

unread,
Apr 8, 2010, 10:57:30 AM4/8/10
to Carrington CMS Theme Framework for WordPress
My main reason is because I had not heard of it. I will look into
it. Do yo happen to know any good text out side of codex to show me
how it can be used?

On Apr 7, 9:28 pm, Kai Pan <kai....@gmail.com> wrote:
> Hm, is there a specific reason you want to use a page to replicate the
> category archive function? Why not just call the category archive? Is it for
> URL shortness or something? Even then, you can just use a redirect like Page
> Links To plugin to accomplish the same thing.
>

> On Thu, Apr 8, 2010 at 6:37 AM, clayd <ckdot...@gmail.com> wrote:
> > I am trying to create a Page of Post from a single category.  I am
> > looking at the codex for this and do not see how to make it work with
> > the carrington theme.  Can someone please help?
>
> > Clay
>
> > Extra info:
> > Link to Page of Posts on codex:
> >http://codex.wordpress.org/Pages#A_Page_of_Posts
>
> > Custom Page template code:  (Please do not laugh to hard at my
> > attempt, well ok laugh)
>
> > <?php
> > /*
> > Template Name: posts_cat
> > */
> > ?>
> > <?php
>
> > // This file is part of the Carrington Blog Theme for WordPress

> > //http://carringtontheme.com


> > //
> > // Copyright (c) 2008-2009 Crowd Favorite, Ltd. All rights reserved.

> > //http://crowdfavorite.com


> > //
> > // Released under the GPL license

> > //http://www.opensource.org/licenses/gpl-license.php

Kai Pan

unread,
Apr 8, 2010, 11:24:24 AM4/8/10
to carrington...@googlegroups.com
You've never heard of a category archive?

clayd

unread,
Apr 8, 2010, 11:30:05 AM4/8/10
to Carrington CMS Theme Framework for WordPress
TO be honest. Yep. I have never really done much with any of the
archiving functions in wordpress.

On Apr 8, 9:24 am, Kai Pan <kai....@gmail.com> wrote:
> You've never heard of a category archive?
>

clayd

unread,
Apr 8, 2010, 11:33:54 AM4/8/10
to Carrington CMS Theme Framework for WordPress
So one thing about this is that the category archive only shows
summaries of the posts and I want it to look just like the loop. To
be honest I would like this page to only show 1 post per page with a
next and previous button at the bottom that only moves to posts inside
the category.

Clay

Kai Pan

unread,
Apr 8, 2010, 11:44:42 AM4/8/10
to carrington...@googlegroups.com
Do you have a current public WordPress website? I want to see if it has a category link and then point to it and make sure you really don't know what a category archive is before moving on. Most themes will display categories so I'm having a hard time believing you've never used them before.

Which Carrington version are you using? Carrington Blog?

If you want the category archives to show full posts and only one post, then you probably should change the number of posts per archive page to 1 and change the category.php file in the /posts/ subfolder so that it calls for the content folder instead of the excerpt folder.

clayd

unread,
Apr 8, 2010, 12:03:06 PM4/8/10
to Carrington CMS Theme Framework for WordPress
Yes I have a few wordpress sites, but to this point I have not done
much with categories. I have used them on my other sites as they are
ment to work but for what I am trying to create I am running into
issues. I am assigning categories to the posts, but I wanted to
create a page of posts as noted in the codex in the link in the first
page. Now this might not be to correct way to do this and I am ok
with that. I will look more into the cat archive function and see if
I can get it to work.

One thing that i dont like about this is that it is going to mess up
my navigation on the side bar seeing that this will need to be a
static link and not a page. Any thoughts on this?

Clay

On Apr 8, 9:44 am, Kai Pan <kai....@gmail.com> wrote:
> Do you have a current public WordPress website? I want to see if it has a
> category link and then point to it and make sure you really don't know what
> a category archive is before moving on. Most themes will display categories
> so I'm having a hard time believing you've never used them before.
>
> Which Carrington version are you using? Carrington Blog?
>
> If you want the category archives to show full posts and only one post, then
> you probably should change the number of posts per archive page to 1 and
> change the category.php file in the /posts/ subfolder so that it calls for
> the content folder instead of the excerpt folder.
>

Dan

unread,
Apr 8, 2010, 5:23:29 PM4/8/10
to Carrington CMS Theme Framework for WordPress
Regardless of the purpose, here's a snippet I use on my portfolio page
( although I have a hell of a lot more going on on that page ).
http://sproutventure.com/portfolio/


$temp = $wp_query;
$wp_query= null;
$count = 1;
$cat_query = (is_category()) ?
"cat=".intval(get_query_var('cat')) : "category_name=projects"; //
decide if it's a tag/ cat archive page or the projects page.
$wp_query = new WP_Query($cat_query.'&paged=' . $paged);
while ($wp_query->have_posts()) : $wp_query->the_post();

cfct_excerpt();

$count++;
endwhile;
$wp_query = null; $wp_query = $temp;




--
Subscription settings: http://groups.google.com/group/carrington-framework/subscribe?hl=en

Kai Pan

unread,
Apr 8, 2010, 11:42:36 PM4/8/10
to carrington...@googlegroups.com
You can try Dan's method or if you're not using category archives for any other purpose, you can use the Page Links To plugin to have your page link to the category archive (but setting the category archive to only showing 1 post per page).
Reply all
Reply to author
Forward
0 new messages