Questions tagged [get-children]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
58 views

get_children() Archive Template

This is my first attempt at coding & I have come unstuck with the wp_query loop integration. I just want to build a template for a page that will check for children and list their respective ...
ClintN's user avatar
  • 1
0 votes
3 answers
140 views

Show subChild categories

Targets : Show Locations (sub-districts & cities) on the customized shop page & on tab additional information - Show on line 5 I'm building a property site using wordpress and woocommerce. In ...
carlozsan's user avatar
1 vote
1 answer
805 views

WP_Query: "post_parent" and "post_type" combination returning strange results

I'm experiencing some interesting results using post_parent along with post_type (local, WP 5.8): I have a custom post type project (with 'hierarchical' => true) where I'm grabbing all child posts ...
rsigg's user avatar
  • 21
1 vote
1 answer
142 views

Wordpress get the child pages of current page

I want to display the child pages of the current page you are on. <?php wp_list_pages('child_of=67&sort_column=menu_order&title_li=') ?> If I give the id number like above it works ...
Simó Tamás's user avatar
1 vote
1 answer
432 views

wp_insert_post if page doesn't exist under current page

I am trying to dynamically insert a page/multiple pages as a child under the current page in my template file, using wp_insert_post, however I need to first check if the page title already exists ...
Daryl Roberts's user avatar
1 vote
0 answers
22 views

display childs without parent

The following code displays the parent plus its children on the specific parent - and children-category pages as "filter-buttons". But in this list I do not want to display the parent, (...
Ullitasch's user avatar
0 votes
1 answer
41 views

Get children of taxonomies

$terms = get_terms([ 'taxonomy' => array('Movies, Musics, Books, Games'), 'parent' => 0, 'depth'=> 2, 'hide_empty' => false, ]); $sorted_terms = []; ...
Gidromasservis QSC's user avatar
0 votes
1 answer
32 views

check if page have children, but not attachment

I am trying to display a sub-menu with the sub-pages of a parent, if you are on the parent page, and the siblings if you are on one of the child pages, but the problem is that if the page have a ...
Botond Vajna's user avatar
0 votes
1 answer
957 views

Get first level children of a page ID

I am looking to get immediate children of a page ID. I tried below code, but it does not seem to work $pageIDchild = get_pages( array ( 'parent' => 0, 'child_of' =>$pageID, ...
Rohit's user avatar
  • 3
-1 votes
1 answer
207 views

get_term_children specific no id

hi everyone from the codex I found what I needed that is to show the sub-taxonomies by specifying the id of the sub-taxonomy and the macro taxonomy get_term_children( int $term_id, string $taxonomy ) ...
user13320018's user avatar
3 votes
1 answer
226 views

How can I calculate the total number of categories at different hierarchy levels?

I'm trying to make a category counter, but it's not really working. I want to have a common counter of all categories (1168), which I would later display. For example: 1 category is the first level 6 ...
Василий Маркин's user avatar
0 votes
1 answer
111 views

Attempting to get number of grandchildren of page in WP_Query loop

I have a custom archive page(with map and location data) for a custom post type. Due to how the locations are hierarchal(state, city, location), I want to show the states only on the archive page, ...
Benlov's user avatar
  • 21
0 votes
1 answer
246 views

Is there a way to order children of post?

there is a main post: $parent = wp_insert_post([ 'post_type' => 'parent', 'post_name' => 'test parent' ]); and the children: $child1 = wp_insert_post([ 'post_type' => 'child', ...
John Smith's user avatar
2 votes
0 answers
108 views

Adding multiple post queries with parent and children to page - Best Way

So I am interested in allowing a custom menu to show "in three places: Menu area, Homepage body, and footer" based on the posttype "page" table list or parent and children entries and not using the WP ...
samjco-com's user avatar
0 votes
2 answers
47 views

Getting child category id (help with improving my code)

I have here hardcoded category id so I can pull in needed categories and their posts by category. But ideally I would like to get this by calling parent category to list child and post. My code works ...
BoyIsBadNews's user avatar
1 vote
1 answer
1k views

get_children() not working properly – Only on one post?

Client wants to show how many images await the reader in a post. I say: easy peazy. Now I realize: I lied. The system only uses galleries, even for single pictures. $images = get_children(array( ...
kater louis's user avatar
3 votes
1 answer
14k views

How to display child term of current term's parent taxonomy?

I would like to display a list of child terms according to my current taxonomy. Taxonomy name ='course' Photoshop(=child term) ps-thematic#1(= child child term) ps-thematic#2 ... After Effects ae-...
Cha's user avatar
  • 99
1 vote
0 answers
95 views

get_children displaying images removed from the page

Ok so I'm using an ajax function to display all images that are included on the page. function post_love_add_love() { $post->ID = $_REQUEST['post_id']; $args = array( '...
Sean Peterson's user avatar
0 votes
1 answer
221 views

Listing Child Pages in Random order

I am currently using a Plug-in that creates a "silo" structure for my website. It creates a sidebar with a list of the Parent page followed by the Child Pages. It only allows me to show the Child ...
jwklaudijr's user avatar
0 votes
1 answer
625 views

Getting one specific value from get_children array

I have one problem that I'm trying to deal with. I have below array of get_children for Woocommerce order and its suborders created by Dokan plugin, and I'm trying to integrate it with another plugin. ...
Rafal's user avatar
  • 312
0 votes
2 answers
2k views

List all posts with the parent or grandparent of a page with a specified ID

I am using the following code in a page template <?php $args=array( 'post_parent' => 27641, 'post_type' => 'page', ); $my_query = null; $my_query = new WP_Query($args); ...
R Reveley's user avatar
  • 161
0 votes
1 answer
30 views

Why does the first category returned get echoed twice?

I have a category called menu items (category id 19) and two child categories Tacos and Burgers. Why does Tacos get echoed out twice? I get Tacos Tacos Burgers. while (have_posts()) : the_post(); ...
MikeR's user avatar
  • 1
4 votes
2 answers
3k views

Child terms from multiple parents?

I'm using isotope to filter a custom post type. But I only want the child taxonomies of 2 particular parents. I have it working nicely for one parent, but I'm not sure how to modify the array to ...
Laura Sage's user avatar
1 vote
1 answer
121 views

Need help with category listing!

I'm trying to solve this for a while, but I couldn't get a satisfactory way to get what I want. Maybe it's very simple and I'm just too inexperienced. I need a way to display all the article titles ...
codieboie's user avatar
0 votes
0 answers
94 views

How to display child pages with in a limited child content?

I have a php snippet that will displayed child pages. And now, I want to displayed only the featured image with the 55 characters of content only (except the title) and put some button. Like this http:...
user3818821's user avatar
0 votes
1 answer
4k views

Get gallery images from page ID

I have a page within WordPress called 'Gallery', the page ID is 128, and I need to display only the gallery images from that page on a different page with a different ID. The images were uploaded ...
David Alsbright's user avatar
0 votes
1 answer
66 views

How to show the view more on my display of pages shortcode

I want to show the list of childpages under a certain parent page & set how many childpages to display & show the "View More" link below the last child page displaying. What was missing from ...
Kiko Lolo's user avatar
0 votes
0 answers
608 views

Wordpress list child pages of custom post type

Im stuck on this and any help would be appreciated. Say there is a parent page called "Stuff". And Stuff has several pages under it. Stuff more stuff more stuff1 more stuff2 It has no children ...
RMH's user avatar
  • 183
0 votes
0 answers
543 views

Check if post has image

I'm displaying a list of posts and I want to indicate if the posts have images. I'm using this code to check if a post has an image. <?php $attachments = get_children(array( '...
user51590's user avatar
0 votes
1 answer
1k views

Drop-Down Menu of Current Child Pages

I would like to display the child pages of the current page in a select menu, I.E. => <select><option>This is a child page</option><option>This is another child page</...
Toasterdroid's user avatar
8 votes
1 answer
20k views

get_term_children for immediate children only (not grandchildren)

I want to display term children of a custom taxonomy. Currently, I am able to do this using get_term_children, but using this, it displays children and grandchildren, I want to avoid this and make ...
b0nd's user avatar
  • 147
1 vote
1 answer
1k views

Wordpress count child posts of each parent custom post type and use in json array for google maps jquery plugin

So i have been looking for a couple of days now and cant find a solution to this anywhere. It is a fairly bespoke request from a client... I am using a jQuery google maps plugin to add markers for ...
jonhodson1984's user avatar
2 votes
1 answer
1k views

Custom Taxonomy: Parent still counting deleted Child

I have this weird situation when I deleted two child taxonomies but they still seem to be assigned to their parent. I need a overview site for all our products with the taxonomy title ahead. If ...
lastria's user avatar
  • 43
0 votes
3 answers
15k views

WooCommerce - Display product child categories from specific parent

I want to edit the following piece of code: <?php if ( (!$theretailer_theme_options['category_listing']) || ($theretailer_theme_options['category_listing'] == 0) ) { ?> <!-- Show ...
tjwillems's user avatar
1 vote
2 answers
5k views

Display post taxonomies tree

I was able to get all the items of a custom taxonomy for a post, like this: $args=array('orderby'=>'parent',"fields" => "all"); $term_list = wp_get_post_terms($post->ID, 'tvr_amenity', $args)...
Toni Michel Caubet's user avatar
3 votes
1 answer
6k views

How to order get_term_children output by alphabetic order

The following creates drop-down lists of my custom taxonomy children, but the order of the output seems to by creation date, not by alphabetical name. I tried adding orderby to the array with no ...
Chris's user avatar
  • 111
0 votes
2 answers
232 views

Page to output sub-pages (children)

I want to output all sub-pages of a particular page in a neat ul li list. Including: featured image, title, and first 50 characters of page content. I'm very new to Wordpress, I've tried reading ...
Francesca's user avatar
  • 295
-1 votes
2 answers
4k views

get_children - wp_get_attachment_image

I explain my problem: I create a post with an image get_children - wp_get_attachment_image functions returns that image I delete post image and add a different one get_children - ...
nyles's user avatar
  • 1
0 votes
1 answer
463 views

How to attach images that I "insert from url" into the post?

I'm trying to get the list of images in my post, to display them in the front page... the problem is that when I add a new picture from a URL, it doesn't seem to attach it. $images =& ...
user5057's user avatar
  • 125
0 votes
2 answers
3k views

get_page_children() return only titles

I'm using the following code to get a list of all the pages that are children of my project page and display them in a Recent Projects section of my template's footer element. I've noticed that the ...
Iain's user avatar
  • 113
12 votes
4 answers
49k views

Check if Current Category has Children

I need to tell whether or not the current custom taxonomy archive page I'm viewing has child categories. I've got a situation where there are a lot of custom categories with children and the site is ...
user29489's user avatar
  • 143
1 vote
1 answer
280 views

Make Images appear in the same order as in media browser using get children?

I would really like my images to display in the same way I've ordered them in the media browser. What am I doing wrong? $images =& get_children( array('post_parent' => $post->ID, ...
rob-gordon's user avatar
0 votes
1 answer
5k views

Sort get_children by menu_order

I'm using the jQuery Carousel Gallery and unfortunately it's not working with WP's new v3.5 gallery ordering. When the client drags to rearrange images, those changes are not reflected in the front-...
focus97's user avatar
-1 votes
1 answer
2k views

get_category_children/ the new get_term_children not work

I have a custom Walker for a Advanced Search, that outputs the categories for multiple search by categories in checkbox. The Problem here is, that i use the get_category_children for the children ...
jamal's user avatar
  • 19
0 votes
1 answer
4k views

get_children() returns ALL attachments instead only those attached to 'post_parent'

I want to pull four random images from the current post's attachments to display as "featured images". Therefor I am using the following function: function fs_gallery_featured_thumbs( $post_id ) { ...
Dreamingof8a's user avatar
12 votes
6 answers
38k views

Get the first image from post content (eg.: hotlinked images)

I am using this code directly from the codex. function echo_first_image ($postID) { $args = array( 'numberposts' => 1, 'order'=> 'ASC', 'post_mime_type' =>...
byronyasgur's user avatar
  • 3,022
0 votes
1 answer
229 views

List direct children of page

I am currently using the following function to list the children of a page, however the function recursively finds children of the children and I only want to list the direct children of $post->...
George Reith's user avatar
0 votes
2 answers
758 views

filter get_children to return all mime types EXCEPT 'x'

Like it says on the tin - Im trying to create a list of post attachments that includes everything except say audio, which I'll feed into a player instead. The filter needs to be generic: 'audio' not ...
orionrush's user avatar
  • 900
2 votes
1 answer
807 views

How can I paginate image attachments in a post?

I have a post with attached images and I was able to display the images but I'm can't seem to find a way to paginate the results. I am using get_children but now I'm wondering if my method of ...
JohnnyB's user avatar
  • 21
0 votes
1 answer
1k views

Get Child Custom Post Content on Single.php?

I have a custom post type, with children 2 rows deep... Outfit 1 Inner Child 1 Child 1 Child 1 Child 1 Outfit 2 Inner Child 1 Child 1 Child 1 ...
Jezthomp's user avatar
  • 219