triibutu
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Different pages, different categoriesHere’s an example page template that displays posts from the same category as page title under page content (based on WP2.6.3 default theme): https://www.hot.ee/triibutu/page-category-posts.zip
Forum: Themes and Templates
In reply to: Different pages, different categoriesHeck, this is way more useful:
https://moshublog.com/2007/09/10/static-frontpage-combined-with-dynamic-content/
As a matter of fact, I think this is pretty close to what is being asked for here, just needs a little configurability (and paging support):
In the main loop:<?php $page_title = the_title('', '', FALSE); ?>
Then fetch the posts:
<?php $par = 'category_name=' . $page_title; if( isset( $wp_query->query_vars['paged'] )) $par = $par . '&paged=' . $wp_query->query_vars['paged']; query_posts($par); ?>
And then display them as you want. I just copied the loop code from index.php.
The technique is definitely not limited to front page…Forum: Fixing WordPress
In reply to: Catagory separate from main blogNot quite — back then they forgot one simple but very important point (at least for me) in doing this: user convenience. I do NOT want to (or do not want my users to) be messing around with php files on the server each time I add a new category or want to change what static content is displayed. By using pages and *just one* page template I can add new pages for new categories any time I want with my web browser, using normal WP page editing tools. Beats hacking category templates any time of year ??
Edit: something I forgot to mention earlier: it is of course configurable (not hard-coded) what category(or categories) to display on a particular page. I have it just matching the category name with page title in the query_posts(), but using custom fields might make sense too.Forum: Fixing WordPress
In reply to: Catagory separate from main blogHello, as it happens I had a very similar need and after looking around and not finding anything I just wrote a new page template to do just that — include posts from a certain category after “normal” page content. The idea is to have navigational tabs and more rich presentation instead of the default category view and also have different static content for different categories.