Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

[SOLVED] How to create category pages


 
Prev Previous Post   Next Post Next
  #1  
Old Jun 16, 2010, 09:43 AM
glb9235
 
3 posts · Feb 2010
[SOLVED] How to create category pages

Thought I would post this, since I spent hours looking for a solution before I solved it. I was looking for any way to create a page where certain content was on the top (sticky or otherwise), and allow posts to populate it from a specific category. I didn't want just a list of post titles, I wanted the full posts. Here's my fix. I edited the page2cat.php from this plugin:

http://pixline.net/wordpress-plugins/category-page-wordpress-plugin/en/


Here was the original function:
Code:
function page2cat_content_catlist($content){
global $post;
	if ( stristr( $content, '[catlist' )) {
		$search = "@(?:<p>)*\s*\[catlist\s*=\s*(\w+|^\+)\]\s*(?:</p>)*@i";
		if	(preg_match_all($search, $content, $matches)) {
			if (is_array($matches)) {
				$title = get_option('p2c_catlist_title');
				if($title != "") $output = "<h4>".$title."</h4>"; else $output = "";
				$output .= "<ul class='p2c_catlist'>";
				$limit = get_option('p2c_catlist_limit');
				foreach ($matches[1] as $key =>$v0) {
					$catposts = get_posts('category='.$v0."&numberposts=".$limit);
						foreach($catposts as $single):
						$output .= "<li><a href='".get_permalink($single->ID)."'>".$single->post_title."</a></li>";
						endforeach;
					$search = $matches[0][$key];
					$replace= $output;
					$content= str_replace ($search, $replace, $content);					
				}
			$output .= "</ul>";
			}
		}
	}
return $content;
}
Change this:
Code:
					foreach($catposts as $single):
						$output .= "<li><a href='".get_permalink($single->ID)."'>".$single->post_title."</a></li>";
						endforeach;
To this:
Code:
						foreach($catposts as $single):
						$excerpt = $single->post_content;
						$output .= "<li><a href='".get_permalink($single->ID)."'>".$single->post_title."</a></li><p>".$excerpt."</p>";
						endforeach;
Thats it! I fiddled around a lot so if there was something else I changed and yours doesn't work, let me know.
 

Bookmarks

Tags
categories, page2cat, pages



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to create links in posts and pages lmt Center area post/pages 8 Jan 22, 2010 08:57 PM
How to Create a Title Category? lee07666 Page & Category Menu Bars 12 Sep 28, 2009 05:43 AM
Create new category bar with custom includes backstpub Page & Category Menu Bars 0 Aug 25, 2009 04:32 PM
Please help: want to create fixed image for top of each category page WebWeaver Atahualpa 3 Wordpress theme 4 Jun 18, 2009 09:56 AM
[SOLVED] Where are the Pages I create in Atahualpa, stored on the file index configur Leoni Atahualpa 3 Wordpress theme 2 Jun 11, 2009 08:08 PM


All times are GMT -6. The time now is 04:59 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.