[SOLVED] Mixing static content + excerpts on home and category pages ?
Hi there,
I am working on the web site of my bike club and would like to be able to mix static HTML content and excerpts on both the home page and *some* category pages. I am new to all this WP thing, and I must say that I do not know where to start. I was thinking that I would put my static HTML content into files that I can then include, but that is the only hint I do have. Here might not be the right place to ask this question (as I am not sure if it is a theme question or a WP question), so feel free to point me in the right direction. Any pointers will be much appreciated. Subsequently I might want to display exerpts on the home in two columns (I saw a sticky about that) en have different number of excerpts for some categories, but we will cross that bridge when we will cross that bridge. Thanks in advance for your help. Jean-Michel. |
There is a custom query page template in the Gold forum that may do what you want. I typically use the List Category Posts plugin for that type of functionality.
|
Hi Miles,
not sure what the gold forum is (did not find it) but at the fisrt glance it would seem that this plugin will do the trick. Hopefully it is not too heavy as my ISP only allows 32M for PHP, that does not allow for much plugin fantasy at all (especially on a 64bits server)... I'll give it a go. Thanks again, JM |
Hmmm...
This plugin is a start, but not really what I was looking for... Have a look : http://jeanmichel.cazaux.free.fr/sit...ex.php/courses I am trying to have the static content displayed in its own "box" and then the posts formated as "normal" excerpts... Almost like if the static content was the first post of the page displayed "in full" and then the exerpts (somle of them)... Any other hint? I am happy (and probably can) do a bit of basic PHP tweaking if I have to. Thanks JM |
What did you use for the plugins shortcode. You should be able to use something like the following to give you a list if excerpts from 10 posts in a category or categories In this case categories 12 and 13.
There is a list of all the attributes for this plugin on the Other Notes tab. [catlist id=12,13 excerpt=yes numberposts=10] |
I did use those keywords (exactly [catlist name=courses excerpt=yes comment=yes thumbnail=yes]), and it does show the right things, but not really in the format I am expecting...
I think I might throw myself in modifying the index.php just a bit... Sounds like a good challenge but makes each upgrade then more difficult (this stated I am stuck with 3.5.3 due to the Suhosin issue... I you have other ideas, please fire! Thanks, JM |
How do you want them to show?
|
I'd like my page to show excerpts formatted "by default" plus some static content (possibly coming from a file, but that is an option).
The static content would only show on excerpts pages, post pages would show "as normal" posts. A bit like this: http://jeanmichel.cazaux.free.fr/sit...c+excerpts.png What i was thinking (to make it a bit generic) is to have my static content in a file named according to a defined schema (for example static_insert_cat_[ID].html, where [ID] would be the category ID) and in index.html I can test if this file exists and include it if it does. This assumes that: - I can and know how to test what category I am displaying; - I can and know how to test if I am on an excerpts page or a normal page... But I would be surprised if I cannot do that. Thanks, JM |
Couldn't you add a widget area to the top of the center column and use a widget for your static content?
|
I did not know you could put a widget on the center column...
Is this possible? JM |
Ok, after a bit of tinkering with index.php, I eventually got where I wanted to be...
In the current guise, my solution includes the content of a file named static_heading_cat_slug.html or static_heading_cat_id.html before the posts of category slug (or with ID id) on an excerpts page. The content of the file will be displayed above the posts and after the navigation section. If some static content is found, the number of excerpts is limited to 3 (I did not find a way to make this variable). I could have stopped there but decided to add a bit of icing on the cake... If there are no posts to display, I try to include a file named: -static_empty_cat_slug.html -static_empty_cat_id.html -static_heading_cat_slug.html -static_heading_cat_id.html The first file matching one of these names is included. This allows for having a longuer/different static content when there are no posts. As well, the 'no_content_found' content is not displayed if some static content is found. That is a bit complex maybe, but while at it, I thought I would cover the last mile. I modified the wordpress/theme/atahualpaXXX/index.php file as follows: Between Code:
<?php /* This outputs the next/previous post or page navigation. Code:
<?php /* The LOOP starts here. Do this for all posts: */ Code:
<?php /* STATIC_CONTENT_ON_CATEGORIES */ After Code:
<?php /* This is the actual Wordpress LOOP. Code:
<?php Then we will take care of the case when there were no posts... Towards the end of the file REPLACE : Code:
<?php /* END of: If there are any posts */ Code:
<?php /* END of: If there are any posts */ Ah, last detail, this assumes the files are in the wordpress/uploads directory. I hope this will be useful to someone, please feel free to use and reuse. Jean-Michel |
|
All times are GMT -6. The time now is 08:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.