How can I use get_template_part() function to return the postloop template? I'm using the following code, and it's not working.
PageLines Framework and get_template_part() to get post loop onlyget_template_part
Posted 23 October 2013 - 11:25 AM
Posted 23 October 2013 - 11:55 AM
I am not quite sure what is it you're trying to achieve, can you provide more information please.
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.
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?
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?
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.
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.
Does anyone know how I can get the post loop section only?
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.
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?
Posted 26 October 2013 - 11:22 AM
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:
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');