Jump to content


Photo
- - - - -

PageLines Framework and get_template_part() to get post loop only

get_template_part

  • Please log in to reply
10 replies to this topic

#1 zouleo

zouleo

    Super Member

  • Members
  • 165 posts
  • LocationStockholm
  • Country: Country Flag

Posted 23 October 2013 - 06:30 AM

How can I use get_template_part() function to return the postloop template? I'm using the following code, and it's not working.

Please Login or Register to see this Hidden Content



#2 zouleo

zouleo

    Super Member

  • Members
  • 165 posts
  • LocationStockholm
  • Country: Country Flag

Posted 23 October 2013 - 11:25 AM

Please Login or Register to see this Hidden Content

I almost got it working now using load_loop(). But the strange thing is that I get the output from the starndard loop, not my PageLines designed loop.
 
What could be wrong?


#3 Danny

Danny

    Is Awesome!

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

Posted 23 October 2013 - 11:55 AM

Hi,

 

I am not quite sure what is it you're trying to achieve, can you provide more information please.



#4 zouleo

zouleo

    Super Member

  • Members
  • 165 posts
  • LocationStockholm
  • Country: Country Flag

Posted 23 October 2013 - 12:15 PM

I want to return the result of a query in html (not header and not footer) in a ajax request.

Please Login or Register to see this Hidden Content



#5 zouleo

zouleo

    Super Member

  • Members
  • 165 posts
  • LocationStockholm
  • Country: Country Flag

Posted 23 October 2013 - 09:23 PM

My problem is that load_loop() doesn't return the loop according to my PageLines settings. For example: I have set "Allow Tags in Excerpt" to be "<p><div><span><img><i><a>". But when using load_loop() the excerpt contains <strong>

 

Do you know what could be causing this?



#6 James B

James B

    Advocate

  • Members

  • 5126 posts
  • LocationSurrey - UK
  • Country: Country Flag

Posted 24 October 2013 - 01:06 AM

Is the strong tag inside one of the <div> or other tags anywhere in the excerpt? By the default wp strips out all of the tags other than the ones you set, if you remove the filter does the strong tag still appear in the excerpt?



#7 zouleo

zouleo

    Super Member

  • Members
  • 165 posts
  • LocationStockholm
  • Country: Country Flag

Posted 24 October 2013 - 11:12 AM

It's working on my front page, search result, archive pages etc. But when using load_loop() it's not. What could be the problem?

James B: I'm not sure what filter you are referring to. I'm not using any filter. I'm just using the PageLines settings.



#8 zouleo

zouleo

    Super Member

  • Members
  • 165 posts
  • LocationStockholm
  • Country: Country Flag

Posted 24 October 2013 - 07:30 PM

I'm probably doing it the wrong way. According to the Wordpress documentation it should be possible to use get_template_part() to get a part of the template. I've tried get_template_part( 'sections/postloop', 'section') but that doesn't work.

 

Please Login or Register to see this Hidden Content



Does anyone know how I can get the post loop section only?



#9 zouleo

zouleo

    Super Member

  • Members
  • 165 posts
  • LocationStockholm
  • Country: Country Flag

Posted 24 October 2013 - 07:45 PM

I read in a old topic from 2010 that at that time there was one file that controlled the loop and one file that controlled layout.

Please Login or Register to see this Hidden Content



I am able to get the post loop using load_loop(), but layout is missing. Obviously the theme has changed a bit since 2010, but maby I still need to do something extra to get they layout in the loop?



#10 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 26 October 2013 - 11:22 AM

Hi Zouleo,

First, I think part of the problem is that the WP information you're referring to is referring to themes with standard templates.  Ours are dynamic in Framework, so likely that code won't apply.

 

If you're trying to "return the result of a query in html", it's probably best to use a plugin for it.  I don't know how we could support this, since none of the moderators are coders.  Our developers would likely recommend you engage a professional developer for this goal.  But I still believe you'll likely find a plugin to help.

 

Almost anything will return in HTML, essentially, since Framework is built on HTML5.  There are many query plugins, and many using Ajax.  This is just an example of one such plugin:

Please Login or Register to see this Hidden Content



#11 zouleo

zouleo

    Super Member

  • Members
  • 165 posts
  • LocationStockholm
  • Country: Country Flag

Posted 28 October 2013 - 10:00 AM

Maby a developer could have a look at my question? My guess is that the answer is very simple, if you just know how to do it. In normal themes it is only one line of code:

get_template_part( 'sections/postloop', 'section');

 

Thank you