got it working now…
I added a counter
$i = 0;
$childnum = count($children);
just after the if statement of the children. & added this code
if ($i == $childnum - 1) {
$output .= '<div class="viewmore">'. $viewmore .'</div>';
}
$i++;
after the the code:
$output .= '<div style="clear:both;"></div></div>';
…Thanks again.. 🙂
Related Posts:
- List all posts with the parent or grandparent of a page with a specified ID
- Check if is on child-page of a particular page
- A check for if is parent page, if has children, if has grandchildren
- Can I have two child pages of different parents with the same name?
- Create a “Dummy” parent page for a hierarchy in page listing?
- Allow only new sub-pages to be created
- Is there a default template file for child pages / subpages?
- Get Permalink for the top level parent of child pages
- How to embed page content in a blog post
- Some pages are missing from the Parent Page select in the Editor
- How to display list of child pages of parent page in wordpress?
- Only allow new subpages to be created
- Debugging shortcode problems
- Can’t change parent page
- How to exclude shortcode from specific page IDs if it’s set to global
- Show child pages when on a child page
- select a private page as parent for another private page
- Shortcode produces blank page
- WordPress pages with hierarchy
- load common thank you template with different content for different pages
- remove/hide pages from users backend
- conditional tags- how to use with shortcodes
- List child pages by slug not ID?
- Show own shortcode data on each page
- get_pages() & “child_of”
- Combining ‘depth’ with ‘include’ in wp_list_pages()
- Making audio playlist by getting page’s parent’s ID
- Removing Parent Page URL While Keeping the Navigation Intact
- Organizing Your Pages
- Custom page template for multiple pages
- Can a user find a child page?
- Display child pages in sidebar of parent page in wordpress
- Display child pages in a parent page? [closed]
- Redirect page to default subpage
- How to list a page tree?
- Is it possible to check for shortcodes on a page?
- Page access only from a specific page in wordpress website
- How To Render Shortcode In AJAX Response?
- Keep page hierarchy in wp_list_pages, even if on a child or grandchild
- Listing all child-pages of a parent-page on the parent-page and each child-page?
- How to control display of page lists on sidebar that doesn’t have childrens
- Check if page has subpages
- Exclude child pages args array
- Search anything from a Child and Sub-Pages of their Parent page
- How to get an array of pages ID by some page’s slug and all its children pages in get_posts() function?
- Return true if parent page id matches
- Shortcode runs when editing page
- If page or sub page not working as expected
- How to use wp_dropdown_pages or wp_list_pages to accomplish a menu like this?
- How to insert current user ID in a shortcode?
- Display grandchild page content on parent page
- Display inner pages like posts.[Like how post excerpt works]
- Pre-populating new Page creation with shortcodes
- Childpage title + content on Parent Page
- How to copy specific page content and create child page?
- How to output different content of page on different places in my template
- Pages redirecting to homepage
- custom page or standalone page?
- Firing page_publish where page is child page
- How to finish this loop?
- Get ID of the page where shortcode is included
- displaying child pages in columns when on a parent page
- How to make in post Parent page children page list nummbered
- Woocommerce – Making product pages child of shop
- List of pages – AJAX load more
- How to read a page’s “Shortcodes” from the Template File?
- How to load JS and CSS only on specific Pages using is_page()?
- Listing pages which uses specific template [duplicate]
- How to add jQuery script to an individual page?
- 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)?
- Check whether the child page has siblings
- wp_dropdown_pages default value
- is_page condition not working
- Get all children page ID’s including parent by title
- How to modify the default WordPress ‘Pages’ widget to have titles on the anchor tags?
- is_home() returns TRUE on page template
- Moved WP from example.com/blog to example.com, cannot add pages now
- Adding New Users to Your WordPress Site for edditign only one page
- hard coded html / php pages on local host directory don’t show up in WP dashboard
- the_content of template page
- Styling Previous/Next Pages differently from Index
- How to show ‘tags’ in ‘WordPress Pages’ [not Posts]
- Automatically generate pages from SQL
- Showing Different Code on Pages With Different Layouts
- Get all pages to display at once
- Show specific page on main index instead of latest
- Add Filter to Ignore a Post/Page or a Number of Post/Pages
- I want to create a Weebly site and have it show up as static pages on a WordPress site
- How to make transition slider load before home page
- Block to Popup Page, on demand?
- Odd twitter meta data description on all pages
- Include parent page in list of child pages
- Displaying all pages which comes under a category id
- Remove and change pages label
- Access link page and not folder content of that link
- Custom Upload Adds Ghost File
- How to Change the path of a child page?
- disable trashability for certain pages
- pages won’t show on front page using loop or pre_get_posts