Hmmm... OK so I think I can make this work, but there are some problems with page2cat (or Category Pages as it calls itself in the dashboard):
1 - It appears to be unsupported, so I doubt we ever see a real 2.8 version. Neither the support forum link nor the author link appear to work. That said, I haven't seen any bad behavior in WP 2.8.4 with Atahualpa 3.4.2.
2 - The short-tag functionality, which is the part I need, only puts up a link-list of the selected posts.
3 - It puts the posts after the page title and before the page content. I can finesse this problem by checking the "Do Not Dispaly" box in Atahualpa Page Options and putting my front page title in the body in a <h1 class="pseudo-headline"> tag, and then defining the style for that in the
Add HTML/CSS Inserts section of Atahualpa theme options.
I had thought I could just use a <h1 class="post-headline"> tag, but that doesn't work for reasons I don't understand.
Solving problem #2 was a bit more involved. Let me preface this by saying I'm
not a php or Wordpress expert, and I've never written a plug-in for Wordpress. But... I cranked up my courage and added the following lines to page2cat.php starting about line #631:
PHP Code:
// Hack by RAMilewski to filter the content of a page, check for [bulletin=xx] tag and replace it with the posts in the requested category
// NOTE: uses the same count and category settings as the [catlist=xx] tag. This is bad.
function page2cat_bulletin($content){
global $post;
if ( stristr( $content, '[bulletin' )) {
$search = "@(?:<p>)*\s*\[bulletin\s*=\s*(\w+|^\+)\]\s*(?:</p>)*@i";
if (preg_match_all($search, $content, $matches)) {
if (is_array($matches)) {
$output = "<div class='p2c_bulletin'>";
$limit = get_option('p2c_catlist_limit');
foreach ($matches[1] as $key =>$v0) {
$catposts = get_posts('category='.$v0."&numberposts=".$limit);
foreach($catposts as $single):
$output .="<h2>".$single->post_title."</h2>";
$output .="<p>".$single->post_content."</p>";
endforeach;
$output .= "</div>";
$search = $matches[0][$key];
$replace= $output;
$content= str_replace ($search, $replace, content);
}
}
}
}
return $content;
}
I also added this line at the end of the file:
PHP Code:
add_filter('the_content','page2cat_bulletin');
These changes appear to add a new short tag of the form [bulletin=xxx] that works like the page2cat [catlist=xxx] tag except that it inserts both the title and content of the post into the page.
You can style the insert by adding styles for the class p2c_bulletin to the
Add HTML/CSS Inserts section of Atahualpa theme options.
If anyone out there decides to duplicate this, please note that it was implemented by a bear of very little brain, and that it has been only summarily tested. I don't know the plug-in development process well enough to work through the issues of giving the [bulletin=xxx] short tag it's own category and limit controls in the Category Pages control panel, at least not within the time I have allotted for this project, so this whole thing should be considered just an unsupported hack.
The new function is a slight modification of the page2cat_content_catlist() function which comes just before it in the hacked file. Note that I believe there is an error in that function. The line:
$output .= "</ul>";
near the end of the function should, I believe, be moved to just after the endforeach; line so that the closing tag is included in $content by the str_replace() operation.