Jump to content


Photo
- - - - -

the loop in pagelines framework


  • Please log in to reply
18 replies to this topic

#1 jbrouwer

jbrouwer

    Super Member

  • Members
  • 191 posts
  • Country: Country Flag

Posted 12 December 2011 - 10:42 AM

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.

#2 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 12 December 2011 - 11:18 AM

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:

Please Login or Register to see this Hidden Content



#3 jbrouwer

jbrouwer

    Super Member

  • Members
  • 191 posts
  • Country: Country Flag

Posted 12 December 2011 - 12:12 PM

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?

#4 sanderpinkse

sanderpinkse

    Advanced Member

  • Members
  • 31 posts

Posted 12 December 2011 - 12:12 PM

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!

#5 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 12 December 2011 - 12:19 PM

@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!

Please Login or Register to see this Hidden Content


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.

#6 jbrouwer

jbrouwer

    Super Member

  • Members
  • 191 posts
  • Country: Country Flag

Posted 12 December 2011 - 12:51 PM

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?

#7 sanderpinkse

sanderpinkse

    Advanced Member

  • Members
  • 31 posts

Posted 12 December 2011 - 02:21 PM

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?

Posted Image

#8 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 12 December 2011 - 02:41 PM

Yes you have to rename in the actual php files too like this:

Please Login or Register to see this Hidden Content



#9 sanderpinkse

sanderpinkse

    Advanced Member

  • Members
  • 31 posts

Posted 12 December 2011 - 03:29 PM

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:

Posted Image

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!

#10 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 12 December 2011 - 03:40 PM

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?

#11 sanderpinkse

sanderpinkse

    Advanced Member

  • Members
  • 31 posts

Posted 12 December 2011 - 03:48 PM

Turns out you do. That solved that problem. Thanks again!

#12 jbrouwer

jbrouwer

    Super Member

  • Members
  • 191 posts
  • Country: Country Flag

Posted 12 December 2011 - 05:06 PM

Hi, any thoughts on my last question? Thanks!

#13 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 13 December 2011 - 03:14 AM

Did you create a custom template for that second loop?

#14 jbrouwer

jbrouwer

    Super Member

  • Members
  • 191 posts
  • Country: Country Flag

Posted 13 December 2011 - 10:26 AM

@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.

#15 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 15 December 2011 - 03:33 AM

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.

#16 jbrouwer

jbrouwer

    Super Member

  • Members
  • 191 posts
  • Country: Country Flag

Posted 15 December 2011 - 02:12 PM

Ok. Thanks. Where can I find the template of the loop in pagelines?

#17 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 15 December 2011 - 07:37 PM

The posts are handled in class.posts.php.

#18 signpost

signpost

    Newbie

  • Members
  • 3 posts
  • LocationBrisbane, Australia
  • Country: Country Flag

Posted 02 March 2013 - 11:50 PM

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

Please Login or Register to see this Hidden Content

 

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



#19 Danny

Danny

    Is Awesome!

  • Moderators
  • 15818 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 03 March 2013 - 08:53 AM

Hi Simon,

 

Can you please create a new topic.