Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Montezuma Theme (http://forum.bytesforall.com/forumdisplay.php?f=53)
-   -   [SOLVED] Display pages from one specific category (http://forum.bytesforall.com/showthread.php?t=21190)

Jet9009 Dec 12, 2013 09:33 AM

I don't understand how the template is working in the documentation... Should i create a custom sub-template in montezuma ?

I want to display the first post of 5 different categories. But those categories will be child of the category Projets.

So it will be the 5 first post of the category projets too :).

I'm really sorry if i'm confusing it's hard for me to explain in english ahah. I'm feeling like you are wasting your time with me. x) Sorry sorry :/

And thank you for everything..

edit : http://micheldidier.com/decliic-test/projets

The result i got here is what i want, just the 5 differents colors missing :/

juggledad Dec 12, 2013 11:20 AM

1) create a folder in the Montezuma folder called 'list-category-posts'

2) copy the contents of 'wp-content/plugins/list-category-posts/templates' into that new folder. Now the folder will contain 2 test 'default.php' and 'readme.txt'.

3) rename 'default.php' to 'my-lcp-template.php'

4)edit default.php and change lines 54-56 from
HTML Code:

foreach ($this->catlist->get_categories_posts() as $single):
    //Start a List Item for each post:
    $lcp_display_output .= "<li>";

to
HTML Code:

foreach ($this->catlist->get_categories_posts() as $single):
    //Start a List Item for each post:
    $categories = "";
        foreach((get_the_category($single->ID)) as $category) {
                $categories .= ' cat-'.$category->category_nicename ;
                        }
    $lcp_display_output .= '<li class="post-'.$single->ID. $categories.'">';

5) edit your 'projects' page and inset the short code
HTML Code:

[catlist name="project" content=yes template=my-lcp-template orderby=date order=asc numberposts=5]
this should give you the first 5 posts that have a category of 'project' each post will have an LI with a class of its postID and 'cat-xxxx' where xxxx is it's category slug name

This

Jet9009 Dec 12, 2013 12:51 PM

thanks a lot for your help, i didn't know I had to put the files into montezuma folder.

With the template, my "more link" on each post is not showing anymore,

I've added this line
Code:

$lcp_display_output .= $this->catlist->get_morelink($single, 'a', 'lcp_morelink');
on my template file before the "endforeach". But nothing showing up.

My shortcode is :

Code:

[catlist name=projets template=default numberposts=5 orderby=date order=desc excerpt=yes excerpt_size=30 posts_morelink="Lire la suite." excerpt_tag=p excerpt_class=lcp_excerpt title_tag=h2 posts_morelink_class=morelink class=row]

Anyways, thx a lot for your help guys. As a student, i'm running low on money, i will make a donation to each of you as soon as possible.

Jet9009 Dec 12, 2013 04:37 PM

I've found a solution, adding this line before the end of the loop in the template :
Code:

//Post morelink
$lcp_display_output .= '<a href="' . get_permalink($single->ID) . '">Lire la suite.</a>';


thx again for your help guys!!!

You can mark this thread as solved :) !!!


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

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