Jump to content
jbrouwer

the loop in pagelines framework

Recommended Posts

jbrouwer

Hi, Couple of questions concerning the loop in pagelines 2.0. I have installed the new pagelines plugins for sections and customization, and the action map plugin to find the hooks. - In platformpro, there was a template.postloop.php which could be edited. How can I edit the loop in pagelines 2.0? I would like to add custom fields and change the order of the thumbnail and the title on the homepage. - How can I exclude a category form the loop on the homepage? I tried using the hook "loop_start", but it was not working. This is the code I tried in the functions.php file in the pagelines customize folder: add_action('start_loop', 'exclude_cat'); function exclude_cat(){ if (is_home()) { query_posts("cat=-5"); } } - I created a section with the pagelines section plugin and a custom page called page.test.php in the pagelines customize folder, as I would like to create a second blog page for a separate category (yes, for category 5 which I would like to exclude from the homepage). Now I would like to get the postloop for this category using an if statement. Further, how can I attach the blog layout mode to this section, while still using the magazine layout mode on the homepage. Hopefully this is clear :-) Thanks.

Share this post


Link to post
Share on other sites
Simon
Easiest way, if your using a child theme is to copy the postloop section folder into your child themes sections folder, open the section.php and rename the section name so you can distinguish it from the regular loop. Change the code like this: [code]load_loop(); } } /* End of section class */[/code]

Share this post


Link to post
Share on other sites
jbrouwer
Thanks. That works great. Is it possible to create a second loop on a seperate page for the category I excluded from the homepage loop?

Share this post


Link to post
Share on other sites
sanderpinkse
Could you also use this to duplicate the default loop? In other words, to include two different loops on a page? That would be very convenient... Cheers!

Share this post


Link to post
Share on other sites
Simon
@jbrouwer yes if the page has a custom template. @sanderpinkse Yes you could! You would need to duplicate the folder several times, and make sure to rename each one, to kkep track of them, and make sure you change each classname, then they will all load, i didnt have to change the classname in my example as we just wanted to overide the main loop section, but if you rename the class you could have as many as you want! [code]Class Name: PageLinesPostLoopOne Workswith: main */ class PageLinesPostLoopOne extends PageLinesSection { [/code] You have to change the clss name in both places, and dont forget to give it a new name at the top of the file.

Share this post


Link to post
Share on other sites
jbrouwer
Thanks! I figured it out. How can I use the blog layout mode on the second loop, while still using the magazine layout mode for the homepage? For example, is there a blog layout mode css file I could use for the new created section?

Share this post


Link to post
Share on other sites
sanderpinkse
Thanks Simon, that's very good news. However, I'm not quite sure I follow. The postloop folder in the child theme replaces the default postloop section, even if I rename the section. If I duplicate the postloop folder and rename it, Pagelines loses track of the copy. Or am I missing something? [img]http://drukwerkindemarge.org/images/Screen-Shot-2011-12-12-at-15.10.png[/img]

Share this post


Link to post
Share on other sites
Simon
Yes you have to rename in the actual php files too like this: [code]Section: PostLoopOne Author: PageLines Author URI: http://www.pagelines.com Description: The Main Posts Loop. Includes content and post information. Class Name: PageLinesPostLoopOne Workswith: main */ class PageLinesPostLoopOne extends PageLinesSection { [/code]

Share this post


Link to post
Share on other sites
sanderpinkse
I did change the class name when I first tried it, but that didn't seem to make a difference. However, I got it working - well, sort of. The new sections didn't show until after I switched between the regular theme and the child theme and back again. Probably some sort of caching problem. I made two new post loops. The Pagelines Template Setup now shows three loops: [img]http://drukwerkindemarge.org/images/Screen-Shot-2011-12-12-at-16.22.png[/img] The only problem is that the third loop shows exactly the same content as the second loop, even though they are different. If I change the order of the second and third loop, the content changes to that of the loop that comes first, but still gets repeated. The main thing is that it is working. I doubt I even need more than two loops. Thanks for the help!

Share this post


Link to post
Share on other sites
Simon
Yes you need to refresh the store to rebuild the sections cache. I wonder if you need to reset the query if you are using more than one on a page?

Share this post


Link to post
Share on other sites
sanderpinkse
Turns out you do. That solved that problem. Thanks again!

Share this post


Link to post
Share on other sites
jbrouwer
Hi, any thoughts on my last question? Thanks!

Share this post


Link to post
Share on other sites
jbrouwer
@Catrina Yes, I created a custom template for the second loop. Hence, I have two loops on two pages (the homepage and the page with the custom template). Whenever I swith from blog mode to layout mode it affects both pages, which is a good thing of course. However, now I would like to keep the magazine layout on the homepage and swith to blog mode for the second loop. How does pagelines call these different layout modes? I looked at the source code, but could not find any differences in id's or classes. Thanks.

Share this post


Link to post
Share on other sites
catrina
There shouldn't be any difference in IDs or classes (rather, just the way the page is assembled). That kind of custom work might be going beyond the scope of this forum, though.

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
jbrouwer
Ok. Thanks. Where can I find the template of the loop in pagelines?

Share this post


Link to post
Share on other sites
signpost

I need to add a custom post type to all post queries (blog, tags, category, search, etc).  In wordpress it is achieved by:

add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
  if(is_category() || is_tag()) {
    $post_type = get_query_var('post_type');
	if($post_type)
	    $post_type = $post_type;
	else
	    $post_type = array('post','gor_map_items');
    $query->set('post_type',$post_type);
	return $query;
    }
}

 

For some reason pagelines ignores this change, so I implemented a new section like the example above but the pagination does not work.

 

How can I get pagelines not to ignore the above code or use a pagelines hook to fix the problem?  Help needed.

 

Thank you,

 

Simon

Share this post


Link to post
Share on other sites
Danny

Hi Simon,

 

Can you please create a new topic.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×