[SOLVED] Display pages from one specific category
Hi guys,
I'm using for the first time Montezuma and it's also the first time i'm trying to make kind of a professional website with Wordpress (for the cms, php and all the dynamics stuff). I'm still in school and studying multimedia, webdesign, devlopment in France, sorry if i'm using a bad or aproximate english. I got 3 really different pages so i guess i should use 3 different main templates in Montezuma or create them. The first one which i'm pretty done with is looking like this in my illustrator mockup : https://www.dropbox.com/s/4n4oh94obl...2013.47.58.png The second one i'm working on it and stuck on it is looking like this : https://www.dropbox.com/s/y7szcgob0n...2013.48.06.png As you may see, the first page is looping through the 3 last post, and for the slider i've created a dynamic_sidebar and used a widget in order to show featured posts. The color are changed using css and created categories/class from each post. Yellow for what's about school for example... Then purple for what's about the back country... etc On my second page, who's the "project" page, i want to display the 5 last project on which the organisation is working. But... I don't know if i've to loop through the post or pages. I'm explaining : for the 3 posts on the main page, i'm simply using the bfa_loop thing and looping through posts... But on the "Project" page, i've to loop through pages or post (what's the best way ? looping through pages or posts ?) and display the different projects. My idea was to add a category to each post i'd like to show on this specific page like category called "projects" and then loop through all my post and only displaying the ones who are belonging to "projects"... But i can't find how to do it :/ I have to admit i'm a bit lost, i've asked to one of my teacher he doesn't know how to help me because he is not using wordpress lol. I hope one of you will understand what i'm trying to do and will be able to help!! Thx, Jet. |
I have used the List Category Posts plugin with various attributes for something like this. It's hard to explain so you will have to read through the documentation to understand how to configure it.
|
Ok, i'm going to have a look at this plugin... thanks !
If you guys got any idea about doing the same thing without using a plugin but doing it directly in a virtual template or subtemplate it could be useful. Thanks anyway ! |
Quote:
I'm back after a few tries, I've tried to work with the plugin you told me to. It's working if i want to display posts from a category, and display the title of the post, the excerpt... (but not a read more link, don't know why) But i can't add a class generated like Montezuma template is doing it easily... I mean : When my page is loaded into the browser, if I inspect the element, their should be two classes on each <i> item... Why ? Because, i have to show every "project" post... But the color of each post has to be different by using another categorie. For example : <li class="projects rehab"/> and <li class="projects garden"/> We can do it easily in the montezuma's template by saying <li class="post-category"/> I'd like to do kind of the same thing... In the plugin doc, we have : Quote:
But I guess we can't link a montezuma virtual template to the plugin... or i'm doing it the wrong way... right ? |
If you want the <li class="projects rehab"/> and <li class="projects garden"/> to have different colors, the CSS selectors you would use would be
HTML Code:
li.projects.rehab {…….} |
If you create your sub-categories as children of the Projects category, then it should be relatively easy to color-code each sub-category.
For example, if you create the Garden category with Projects as its parent, and another category called Rehab, also with Projects as its parent, then this address will display all posts with the category of Projects, including all those belonging to Garden and Rehab: yoursite.com/category/projects Each individual post will have the class category-projects assigned to it, as well as either category-garden or category-rehab. |
sorry for the late reply guys,
I had to fix some glitches on my web host! I don't get it, i'm using the plugin you told me to use. (List Category Post plugin). You can see the result here : http://micheldidier.com/decliic-test/projets I got everything I need as we can see... But... There is no css class on the <li> element. and i can't find how to dynamicly create some with the help of PHP and make it work kind of the same way as the bfa loop is working (generating element dynamicly like <li class="category-projets category-rehab"></li> for example) I can create one, but it will not change and it will be the same for every <li> elements. http://wordpress.org/plugins/list-ca...s/other_notes/ I may be blind or missing something... if you got any advice... thanks a lot ! edit : the best way could probably be to create a template... but i don't get it because it's probably not working with the montezuma PHP shortcodes... :/ |
As I mentioned earlier, I would just use a category page and style that. That way, your post excerpts get assigned the right classes.
|
Oh ok ! I think i get it now :)
So i've done what you are saying. But i got two problems for styling the page... x) the first one is that bfa_loop is adding <div class="post-list"> is there any way to change this div to <div class="post-list row"> ? It's because i want my post on two colums and by adding this class in firebug I got the result I need. I've changed it in the php file of montezuma where there is bfa_loop but it's messing up my index page also using bfa_loop... eheh. And by adding a function to the file called something like bfa_loop_category and adding into the generated div the row class. Then using the "bfa_loop_category" in my template for the categroy... it's not working :/... The other thing is... bfa_loop is showing up the 3 last post, because it's the parameter in wordpress, and what i want on my index page... But here, I need 5... How could I do that ? i've seeked into the documentation but didn't found anything :/ Thanks again for your help guys ! edit : http://micheldidier.com/decliic-test/category/projets |
Quote:
Code:
.post-list .post { How many posts have you created for your web site so far, that you've assigned the category of Projets? |
thanks for your help and your CSS. I've tried something else who didn't work (adding the styles from .row to .post-list)
I've created a fake 4th one just to try and it was creating adding a nav and a second page... :/ |
It looks like the CSS messed up your home page. Change the CSS to this:
Code:
.category .post-list .post { |
1 Attachment(s)
looks ok to me, what is wrong?
Quote:
|
This home page.
|
Thanks CrouchingBruin, i've noticed that later ^^.
@JuggleDad -> as you can see, there is 3 post displayed on the homepage, but there is 4 post, so the nav is added and i got a second page. it's ok, working great, that's what i want. But, on the page Projets, I want 5 post, the 5 post who will be the 5 project of the non lucrative association i'm working with (Decliic). In the Dashboard i got 3. If there is no choice, I will put 5 and I will have 5 post displayed also on my index page. |
If you want at least five posts to appear on your Projets page, then you have to create at least five posts with the category of Projets.
|
Yes, but : The question is, can I display 5 post (when they will be created) on my project page, and only 3 on the index page ?
It's linked to the dashboard parameter, so my guess is no, i don't have any choice but changing 3 to 5. Am i wrong ? |
Ah, now I understand. So you want your Projet page to display only the latest post for each of five projects? Sorry to make you do all that work before. I would create a static page and use this plugin. What's nice about this plugin is that it has options for wrapping the returned posts and post parts (like the post title) in whatever tags that you want. So you can insert five different shortcodes that pull in the latest post from a specific category.
As an example, on this page, I used the plugin to display the latest post from one category using this shortcode the post is at the bottom of the page): Code:
[xilipostinpost query="cat=9" showposts=1 showcontent=1 showexcerpt=0 beforetitle='<h2>' aftertitle="</h2><br />" beforeall="<span id='MMTitle'>Sensei's Monthly Message</span>" afterall="" beforecontent='<div class="xi_postinpost_content">' aftercontent='</div>'] |
It's not the last 5 post from projects... But the first 5 post ahah.
I will have a Parent category called => Projets, then 5 differents categories who will be child of projets. The first post will be in "projets" and for example "rehab" the second in "projets" and for example "garden"... etc Something like that, 5 times. Those "first posts" of each categories will explain the 5 different projects of the association (who are a café, a day care, a public garden... ect.). That's why I want to display only those specifics post on the page Projets. Your plugin xili post could do it ? Did I explain better ? ^^ Sorry for my bad english :/ edit : your slider is really nice on the top ;) |
That would be easy, since you would know the post ID of the posts that you want to display. That is, each post that you create has a unique ID associated with it. So instead of selecting the post by category, select it by post ID. For example, your Alentours has a post ID of 23. You can easily select a post by its ID with the plugin. Instead of using cat=x, use p=23 on the query.
|
Oh ! thank you thank you !
I'm gonna try it this way :) i'll let you know :) |
I've tried your plugin but i've some problems for the styles... Maybe because the plugin is creating some weird empty elements... I don't understand... When you are looking at the source code on my page, you can see http://micheldidier.com/decliic-test/projets
Code:
<div class="post-list row"> And inside Code:
<div class="post-bodycopy cf col6"> I think i can't style it like on this page here http://micheldidier.com/decliic-test/category/projets because of that :/ My shortcode is (x5) : Code:
[xilipostinpost query='p=23' showexcerpt=1 beforetitle='<h2>' aftertitle='</h2>' beforeall='<div class="post cf"><div class="post-bodycopy cf col6">' afterall='</div></div>' beforecontent='' aftercontent='' read='Lire la suite.' aftereach='' beforeeach='' beforeexcerpt='' afterexcerpt=''] |
Try out the 'List category posts' plugin.
You can control the number of posts to show you can define the category show excerpts or full post pick a value to order the posts by sort them ascending / descending define classes for several of the parts of the post try it, you may like it. |
Quote:
as i've said on post 7, Quote:
edit : now with list category post's plugin : http://micheldidier.com/decliic-test/projets you can see i can't apply any class on the li elements... and even if I could apply a class, there will be all the same, i can't make 5 differents color with this plugin because i can't have class="category-rehab / category-cafe / category-assistance.. etc" on each li (on different class for each) or maybe i'm forgetting something ? |
If you read the documentation for the list-category-posts plugin you will see that you can create your own template and easily add the post ID to the <li> so you get <li class="post-33"> etc or anything else you want (with a little coding).
Maybe we are all confused in what you want to do - I thought you wanted a page where you could display the first 5 posts that were in a particular category. is that correct or are you trying to display the first five posts which will all be in different categories? |
All times are GMT -6. The time now is 10:35 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.