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 » Montezuma Theme »

[SOLVED] Display pages from one specific category


  #1  
Old Nov 26, 2013, 11:58 AM
Jet9009
 
23 posts · Dec 2010
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.

Last edited by Jet9009; Dec 5, 2013 at 12:49 PM.
  #2  
Old Nov 26, 2013, 02:47 PM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
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.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #3  
Old Nov 26, 2013, 04:39 PM
Jet9009
 
23 posts · Dec 2010
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 !
  #4  
Old Dec 2, 2013, 02:45 PM
Jet9009
 
23 posts · Dec 2010
Quote:
Originally Posted by lmilesw
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.
Hi,

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:
Template System

Templates for the List Category Plugin are searched for in your WordPress theme's folder. You should create a folder named list-category-posts under 'wp-content/themes/your-theme-folder'. Template files are .php files.

You can use the included template as an example to start. It's in the plugin's template folder under the name default.php. To use a template, use this code:

[catlist id=1 template=templatename]

If the template file were templatename.php.

You can have as many different templates as you want, and use them in different pages and posts. The template code is pretty well documented, so if you're a bit familiar with HTML and PHP, you'll have no problems creating your own template. I'm planning on reworking the template system in order to have a really user friendly way to create templates.
http://wordpress.org/plugins/list-ca...s/other_notes/

But I guess we can't link a montezuma virtual template to the plugin... or i'm doing it the wrong way... right ?
  #5  
Old Dec 2, 2013, 03:49 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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 {…….}
li.projects.garden {…….}
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #6  
Old Dec 3, 2013, 12:38 AM
CrouchingBruin's Avatar
CrouchingBruin
 
299 posts · Aug 2010
Santa Monica, CA
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.
__________________
My Montezuma-themed sites: ESHS Girls Basketball Team, Venice Hongwanji Buddhist Temple
Please consider making a donation to BytesForAll for their great themes!
  #7  
Old Dec 9, 2013, 09:16 PM
Jet9009
 
23 posts · Dec 2010
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... :/

Last edited by Jet9009; Dec 9, 2013 at 09:19 PM.
  #8  
Old Dec 9, 2013, 09:26 PM
CrouchingBruin's Avatar
CrouchingBruin
 
299 posts · Aug 2010
Santa Monica, CA
As I mentioned earlier, I would just use a category page and style that. That way, your post excerpts get assigned the right classes.
__________________
My Montezuma-themed sites: ESHS Girls Basketball Team, Venice Hongwanji Buddhist Temple
Please consider making a donation to BytesForAll for their great themes!
  #9  
Old Dec 10, 2013, 11:17 AM
Jet9009
 
23 posts · Dec 2010
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

Last edited by Jet9009; Dec 10, 2013 at 11:36 AM.
  #10  
Old Dec 10, 2013, 02:22 PM
CrouchingBruin's Avatar
CrouchingBruin
 
299 posts · Aug 2010
Santa Monica, CA
Quote:
It's because i want my post on two colums
For two columns, add this CSS to the end of various.css:
Code:
.post-list .post {
   width: 50%;
   float: left;
}
This makes each post take up half the content width, and floats them so two will fit side-by-side. You may want to add a media query to change back to one column on narrower mobile devices, like a smart phone.

How many posts have you created for your web site so far, that you've assigned the category of Projets?
__________________
My Montezuma-themed sites: ESHS Girls Basketball Team, Venice Hongwanji Buddhist Temple
Please consider making a donation to BytesForAll for their great themes!
  #11  
Old Dec 10, 2013, 02:33 PM
Jet9009
 
23 posts · Dec 2010
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... :/
  #12  
Old Dec 10, 2013, 02:40 PM
CrouchingBruin's Avatar
CrouchingBruin
 
299 posts · Aug 2010
Santa Monica, CA
It looks like the CSS messed up your home page. Change the CSS to this:
Code:
.category .post-list .post {
   width: 50%;
   float: left;
}
__________________
My Montezuma-themed sites: ESHS Girls Basketball Team, Venice Hongwanji Buddhist Temple
Please consider making a donation to BytesForAll for their great themes!
  #13  
Old Dec 10, 2013, 02:41 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
looks ok to me, what is wrong?

Quote:
I've created a fake 4th one just to try and it was creating adding a nav and a second page... :/
how many posts did you set the blog page to display (dashboard->Settings->Reading)
Attached Thumbnails
Click image for larger version

Name:	mont-2col.png
Views:	1977
Size:	63.2 KB
ID:	2452  
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #14  
Old Dec 10, 2013, 02:42 PM
CrouchingBruin's Avatar
CrouchingBruin
 
299 posts · Aug 2010
Santa Monica, CA
This home page.
__________________
My Montezuma-themed sites: ESHS Girls Basketball Team, Venice Hongwanji Buddhist Temple
Please consider making a donation to BytesForAll for their great themes!
  #15  
Old Dec 10, 2013, 02:55 PM
Jet9009
 
23 posts · Dec 2010
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.
  #16  
Old Dec 10, 2013, 02:57 PM
CrouchingBruin's Avatar
CrouchingBruin
 
299 posts · Aug 2010
Santa Monica, CA
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.
__________________
My Montezuma-themed sites: ESHS Girls Basketball Team, Venice Hongwanji Buddhist Temple
Please consider making a donation to BytesForAll for their great themes!
  #17  
Old Dec 10, 2013, 03:03 PM
Jet9009
 
23 posts · Dec 2010
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 ?
  #18  
Old Dec 10, 2013, 03:30 PM
CrouchingBruin's Avatar
CrouchingBruin
 
299 posts · Aug 2010
Santa Monica, CA
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>']
The beforetitle, aftertitle, beforeall, afterall, beforecontent, and aftercontent options allowed me to add the classes and HTML that I needed to format the post the way I wanted using CSS.
__________________
My Montezuma-themed sites: ESHS Girls Basketball Team, Venice Hongwanji Buddhist Temple
Please consider making a donation to BytesForAll for their great themes!

Last edited by CrouchingBruin; Dec 10, 2013 at 03:37 PM.
  #19  
Old Dec 10, 2013, 03:37 PM
Jet9009
 
23 posts · Dec 2010
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
  #20  
Old Dec 10, 2013, 03:55 PM
CrouchingBruin's Avatar
CrouchingBruin
 
299 posts · Aug 2010
Santa Monica, CA
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.
__________________
My Montezuma-themed sites: ESHS Girls Basketball Team, Venice Hongwanji Buddhist Temple
Please consider making a donation to BytesForAll for their great themes!
  #21  
Old Dec 11, 2013, 02:02 PM
Jet9009
 
23 posts · Dec 2010
Oh ! thank you thank you !
I'm gonna try it this way i'll let you know
  #22  
Old Dec 11, 2013, 05:12 PM
Jet9009
 
23 posts · Dec 2010
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">
<p> </p>
<div class="post cf">
<p>
<div class="post cf">
<p>
<div class="post cf">
<p>
<div class="post cf">
<p>
<div class="post cf">
<p></p>
</div>
I got all those empty <p> coming from no where...

And inside

Code:
<div class="post-bodycopy cf col6">
<br>
<h2>
<p></p>
<p>
</div>
The <br> coming from no where and another empty <p>...

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='']

Last edited by Jet9009; Dec 11, 2013 at 07:23 PM.
  #23  
Old Dec 11, 2013, 07:30 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #24  
Old Dec 12, 2013, 08:32 AM
Jet9009
 
23 posts · Dec 2010
Quote:
Originally Posted by juggledad
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.

as i've said on post 7,

Quote:
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... :/
then, crounchingbruin told me to use something else...

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 ?

Last edited by Jet9009; Dec 12, 2013 at 10:07 AM.
  #25  
Old Dec 12, 2013, 10:09 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Last edited by juggledad; Dec 12, 2013 at 10:27 AM.

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to: display category name on category pages wittyusername Center area post/pages 3 Feb 25, 2011 07:25 AM
"RIGHT sidebar: Don't display on Pages" on children of specific parent Sprutt Sidebars & Widgets 1 Mar 23, 2010 04:12 PM
How to Display Comments on Category Pages Only fylraen Comments, trackbacks & pings 4 Nov 5, 2009 03:04 PM
Full Post Text on specific category pages spencer Atahualpa 3 Wordpress theme 1 Jul 7, 2009 03:47 PM


All times are GMT -6. The time now is 02:52 AM.


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