I would like to suggest you to use WP_Query
to fetch pages from db:
$the_query = new WP_Query( array(
'post_parent' => $page->ID,
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => 3,
) );
while ( $the_query->have_posts() ) :
$the_query->the_post();
?>
<div class="span4">
<h2><a href="https://wordpress.stackexchange.com/questions/83491/<?php the_permalink() ?>"><?php the_title() ?></a></h2>
<?php the_content() ?>
</div>
<?php
endwhile;
wp_reset_postdata();
Also be careful! You use $page
variable at first line of your snippet as already defined, and then you re declare it again when you use it in the foreach
loop at the 2nd line of your snippet.
Related Posts:
- How can I keep the content of my pages version controlled?
- How to load JS and CSS only on specific Pages using is_page()?
- Listing pages which uses specific template [duplicate]
- How do I convert a page’s title to lower case?
- page title, parent tilte and grand parent title
- How to add jQuery script to an individual page?
- WordPress page edit does not save selected template
- Manual excerpts for pages not working on Search
- How do I set and list page_template with wpcli?
- How to get post or page excerpt using post_excerpt
- Different fields in My Profile page depending on user role
- Object gets unwanted width and height
- WP is not using the select custom template.php that its selected for a page
- Is it possible to set a page template on a dynamic home page (articles list)?
- What’s the most minimal way in which a page can be hooked into WP?
- Associate Page with User
- Limit the number of pages created by the paging
- One page – Multiple parents?
- Check whether the child page has siblings
- How to re-order pages en-masse
- wp_dropdown_pages default value
- how to get specific page content
- is_page condition not working
- How to create a metabox that will list all my pages in a dropdown selector?
- Personal page for every user (not just authors)
- Create ghost page
- Relative instead of absolute links in pages?
- Produce a plain page with only a message
- load common thank you template with different content for different pages
- Password Protected Page Title
- Send mail from page using wp_mail
- Page displays content from different query?
- Site url is not showing the home page
- Can’t locate a hidden private page
- I can’t edit my homepage – the page editor is just blank [closed]
- Making audio playlist by getting page’s parent’s ID
- Restricting Pages based on Hierarchy and User Role
- page-name.php doesn’t execute on custom template
- How to retrieve attachments from child pages of a specific Page?
- Admin taking a very long time to load
- how to display sidebar on pages in wordpress
- Hide page templates without using ‘unset’
- How to capture GET argument on static page
- page.php is not called, falls back to index.php
- Custom page in archive page for certain category
- I would like my page editor to be sorted by date created, or updated, instead of in Alpha order, is this possible?
- Is it possible to check for shortcodes on a page?
- Show FormCraft form on page open [closed]
- Use same page-mypage.php template for several pages
- Why last blog post excerpt is shown instead of meta description? [closed]
- Prevent non-admin to add/create new pages
- How do you implement a page template automatically being applied to a page?
- Is it possible to restrict access to specific pages in the admin area based on the page slug?
- Make “default” wordpress pages & features unaccessible
- How to create cutom link for page
- Set a variable to using in redirected page
- Show parent & child pages with featured image and hide the current page
- Publish page by invoking submit via jQuery
- One author not showing in Author drop down list while editing page
- WordPress Page Protect forwards to Admin Login
- How can I edit pages from my local environment?
- Modifying .page-content background image
- products category page editing
- “Can’t update in WordPress”
- Why can’t pages be categorized / tagged?
- Adding in additional pages into a custom theme
- Pages in wp-admin is not found 404
- Shortcode runs when editing page
- List of pages of a specific user
- wordpress page navigation numeric pagination showing same posts on each navigation
- WordPress dosn’t save page/post updates
- Multiple meta_key with get_pages
- Sup pages can’t be found
- How to use wp_dropdown_pages or wp_list_pages to accomplish a menu like this?
- Get child pages in get_pages function
- Send e-mail from admin area to adresses in custom field
- Bundle a page with custom url and a function
- Custom Upload Adds Ghost File
- WordPress white screen with “All Pages”
- How to exclude sidebar from pages?
- Widget & storing a Select box choice
- How to Change the path of a child page?
- disable trashability for certain pages
- Can’t select a page using is_page()
- If searched in a category show different 404 page
- pages won’t show on front page using loop or pre_get_posts
- How can I cycle posts with a #next and #previous script?
- Using Page/Post Slug In Link / URL
- Does WordPress list all pages for crawlers?
- List of pages – AJAX load more
- one time visit to the page
- How to display child page from specific parent page in homepage?
- How to display text of a page in home or custom page?
- How do I count the number of pages a user has seen on my site, and force them to log in after a certain amount
- Split Page Links
- Ask for template when adding a new page
- How to view front-end of WordPress website, using Atom?
- I reached halfway through a WordPress tutorial to find out I began wrong for a new comer to WP
- Can’t create new pages in wordpress
- Custom template is not showing up in templates dropdown list after re-naming it