Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End help with foreach loop Reply To: help with foreach loop

#156367
cybershot
Participant

I have been trying for over a year to make a one page wordpress theme without using ajax. I figured there is a way to get the content without using ajax. I got it working but it’s not the greatest. I found that the pages ignore the page templates. So if you make a page and assign a page template, the page will come up blank. The only way I have been able to get it working is to make a shortcode and put the page query into that and put the shortcode into the page with a blank template. So I have my query just checking to see if the page has assigned a page template and if it does to run the content. I am trying to find another way. A better way that doesn’t need shortcodes to make it work. So I have been messing with including the page templates. I might have already tried this but not sure. So I have a custom loop and now I am trying to get the page templates. inside the loop, I have this

$template = get_post_meta( get_the_ID(), '_wp_page_template', TRUE );

That will get all the page templates. So I tried a foreach loop as shown above to include them.