Questions tagged [children]

The tag has no usage guidance.

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

Query for posts belonging to multiple categories

Within the default Post categories I have A parent category Cities -- City A -- City B -- City C A parent category Beauty -- Hairdressers -- Pedicure A parent category Sightseeing -- Archeological -...
Brecht Schoeters's user avatar
0 votes
0 answers
14 views

Are there any drawbacks to using comments as a child post type?

I am planning on making a website for users to post help requests for companies to bet on. So I will have a post type "help request" and thought of using comments for storing the price offer ...
Rihards Egle's user avatar
0 votes
1 answer
337 views

Query to Exclude Child Pages from Custom Post Type Archive

I have a hierarchical custom post type called "Services". On the Services archive page I want to display only parent Services and exclude child Services. I found similar answers to my ...
scpers0n's user avatar
0 votes
1 answer
270 views

check if current page is a child of a specified top level page

I am writing some code that will embed a chat bot to specified pages on my site. I have a function/shortcode that accepts 2 parameters, include and exclude. The value of each can be a single post ID ...
Daveh0's user avatar
  • 189
1 vote
0 answers
214 views

WP_Query with meta_query for children

I'm using WooCommerce and it has a lot of plugins to handle different stuff. The one thing needed by the client that no other plugin manages correctly is which variations can be visible for each user ...
ZioCain's user avatar
  • 111
0 votes
1 answer
85 views

wp_list_pages two columns

I have a piece of code that splits my wp_list_pages navigation into two columns: <div id="head"> <ul> <?php $page_s = explode("</li>",...
Josh Rodgers's user avatar
  • 1,173
0 votes
1 answer
953 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 vote
2 answers
440 views

How to target a specific custom post type post and its all children and grandchildren?

I will really appreciate your help to create a function that will check by a given $my_custom_post_type_name and $post_name and return true if the current page / post is a $post_name or $...
Victor's user avatar
  • 25
0 votes
2 answers
24 views

Show children connected to parent pages

Can someone assist with a function code that displays children on a parent page. I have breadcrumbs for when standing on child page going back to parent but, I need standing on parent page to ...
iadzemovic's user avatar
1 vote
0 answers
29 views

Taxonomies on custom taxonomies

I have a custom post type with multiple custom taxonomies. I need those taxonomies to have a relationship as well. The trick is, I need a child to be able to have multiple parents. I understand that ...
John McCulley's user avatar
0 votes
0 answers
259 views

wordpress custom menu - show parents, siblings, children depending on depth

looking and trying for hours to find a solution for the following output of a wordpress custom menu. Hope you can help. I do not know where to start: custom menu walker, css, functions.php I have a ...
flo's user avatar
  • 21
0 votes
1 answer
1k views

Walker class for sub-menu with ACF fields

Firstly, I'm wondering if this is the best way to even do this. I have a basic nav, one item has children. The children need to be wrapped in a container div and each child needs to pull some ACF ...
Phill's user avatar
  • 197
0 votes
2 answers
869 views

Menu walker: how to tell if a sub menu contains submenus?

I mean: <ul> <li> <ul class="sub-menu"> <li> <ul> <li></li> <li></li> <li></li> ...
Luca Reghellin's user avatar
0 votes
1 answer
254 views

How to show children terms even if they are empty

First of all im not good at PHP so it might be the problem... So after trying to do what I want without success I want to ask our help. For most of you probably it will be easy as eating breakfast. I'...
Christian Mate's user avatar
0 votes
1 answer
470 views

Child and Parent Pages list of sub pages

I have a parent page called services with children, each service child has child pages within it. On the first level child page i want to show all of the pages below it in. When i click through to ...
reigns1989's user avatar
0 votes
1 answer
2k views

How to display only the direct children of a term on a taxonomy page

I would like to have a couple of (automatically generated) taxonomy pages created by term name, term description and a listing of only the next level of subterms. (No parents and no grandchildrens) I ...
Knarf's user avatar
  • 3
1 vote
0 answers
97 views

How to show all possible parents and children of a hierarchical taxonomy term?

I have a hierarchical custom taxonomy "company". Companies are hierarchical, they can have both owners and subsidiaries. So, some of my "company" terms have parents and children. Take this real ...
Robert Andrews's user avatar
1 vote
0 answers
221 views

Sort order by slug for looped child terms of custom taxonomy

I have page that displays multiple carousels that contains the posts for each child term of parent taxonomy: projects for the custom taxonomy: portfolio-categories for CPT: portfolios. When Portfolio ...
Kay's user avatar
  • 53
0 votes
2 answers
4k views

`get_terms()` with `child_of` and `childless` combined

I have a hierarchical taxonomy filter that contains locations and genres for posts with the custom type artist: - Genre -- Hip Hop -- Trap -- Rap - Location -- Europe --- Germany --- Sweden --- ...
rassoh's user avatar
  • 576
0 votes
1 answer
5k views

Orderby menu_order not working; menu is sorted on publish date

I have made a menu in the admin page ordered like this: parent - child 1 - child 2 - child 3 parent - child 1 - child 2 - child 3 parent - child 1 - child 2 - ...
Rubenxfd's user avatar
  • 113
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
0 votes
4 answers
979 views

Display children category images

I have worked four hours on this but with no result. There is a custom taxonomy and I need to display the image of the child category but displays the image of parent category. My code is: <?php ...
vesta's user avatar
  • 1
0 votes
2 answers
4k views

is_child() function

My need is to check if a page is subpage of a page (with ID). I try to get this code working but it doesn't. function is_child($pageID) { global $post; echo $post->post_parent; // display the ...
Valentin's user avatar
0 votes
1 answer
637 views

Custom post type loop without children

I've created custom post type "Services" with 'hierarchical' => true,. My loop is simple: while (have_posts()) { the_post(); get_template_part('content', get_post_type()); } ...
acidernt's user avatar
  • 111
0 votes
1 answer
72 views

category & sub category order issues in wordpress

I have Two parent category on my website, and each of those category have children category, like this : constructions corollaires 01 02 03 04 Between two suns I II III ...
user2882154's user avatar
4 votes
1 answer
12k views

Check if post has children or not

I need some code to know if the post has another pages or not unfortunately i didn't find yet now any reference for this so any idea will be appreciated What I need to acheive is if has child /...
adnan's user avatar
  • 323
1 vote
1 answer
2k views

Display Child Pages of Custom Post Type Parent Page

I am attempting to display the child pages of a custom post_type page. I found a shortcode that works great for standard WordPress "pages" post_type, but doesn't work on custom post types. Here is ...
Benjamin Doyle's user avatar
1 vote
1 answer
308 views

How to create template for children category?

I have categories ordered like this: continent->country->city I have managed to have different templates for continent and country(parend and child). But I need also different template for a city ...
user3751604's user avatar
0 votes
2 answers
18k views

Showing categories and subcategories with posts

Basically as the title says I want to get list of categories and subcategories and then posts(with links to them) for those categories/subcategories. This is the structure I'm trying to achieve: ...
Karadjordje's user avatar
0 votes
1 answer
34 views

Displaying Child Page's Information

I am currently working on a custom template for a page, and I would like to pull various information from the child pages of the parent page, and display that information on the parent page. ...
Jessica's user avatar
1 vote
1 answer
1k views

How to Display child post on his parent post with thumbnail and content in WordPress

I am trying to display child post in his parent's post with thumbnail and content. I also created a custom post for products and manage to display only parent post in custom template product.php. Now ...
Rahul Soni's user avatar
0 votes
1 answer
280 views

WP_Query doesn't works inside loop

I'm trying to show a category and his children with this structure (whit this content()): - Category Father title - Children title - Other children title - Category Father title - .....
Marcos's user avatar
  • 187
1 vote
1 answer
2k views

Category shows only top level child categories

I have found this code online but it shows all child categories when on parent category: <?php $this_category = get_category( $cat ); $child_categories = get_categories( array( 'child_of' =...
David's user avatar
  • 87
0 votes
1 answer
1k views

get_pages displays only parents instead of children

Hey there I am trying to fetch all direct children of a page. But I am getting only the parent two pages. Any ideas? Code: function childpages_func( ){ $args = array( 'child_of' => $...
GrampaRay's user avatar
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
0 votes
1 answer
1k views

Running get_posts within get_posts to get children of children

I have a hierarchal custom post type called “courses”. When you arrive on a course post there’s a check to see if the post has children. If the courses post has children it runs get_posts to display ...
morgyface's user avatar
  • 103
0 votes
1 answer
1k views

How do I display child post types in the parent post type template

I have a custom post type called airports which uses a template called single-airports.php. I have created a new airport called Gatwick and created a child of this called called Gatwick North ...
Thomas_Hoadley's user avatar
0 votes
2 answers
2k views

(get_post_ancestors == 2) is returning true on 1 as well?

I am trying to use this code: <?php if(count(get_post_ancestors($post->ID)) == 2 ) : ?> <script>...</script> <?php endif ?> to add a script to a page but only if ...
codeview's user avatar
  • 455
0 votes
1 answer
1k views

Get count for all terms inside a parent term

I am trying to get the post count for a term and it's child terms. I tried it with pad_count=> true but this seems to have no effect. My term stucture is like the following: - term 1: 10 posts - ...
rassoh's user avatar
  • 576
0 votes
1 answer
541 views

Keep page hierarchy in wp_list_pages, even if on a child or grandchild

I have the following structure of pages, and I need to have that same structure displayed on those pages who have child pages: - Childpage - - Grandchildpage - - Other Grandchildpage - Other ...
andyderuyter's user avatar
0 votes
0 answers
28 views

Help understanding custom post type and children

We are considering restructuring our Wordpress site, and I'm trying to better understand how to use custom post types and (possibly) child posts to better organize and control content. The site has ...
Hal Atkins's user avatar
0 votes
1 answer
429 views

get children from current variable (taxonomy) via shortcode

I am working on a portfolio site and I need to modify this part. It is a filter of categories, placed via a shortcode. I want to show only the children categories of the selected category of my ...
artist learning to code's user avatar
0 votes
1 answer
565 views

Show all child categories associated to post ID within loop

I'm looping through all posts and I'm trying to output the category nicename related to each post. So if there are categories A,B and C with post X only associated with categories A and C then I only ...
egr103's user avatar
  • 305
1 vote
1 answer
1k views

How to get the excerpts of all children pages

I'm currently trying to get this working: I want to display a list of excerpts of all children pages within my parent site. According to the WP Codex this ist possible through 'get_pages' function ...
David Freimaucher's user avatar
0 votes
1 answer
36 views

Need list of child category post titles sorted by child category

There seem to be a lot of variations of this type of question, but I have not been able to find one that matches my specific situation or that is less than 4 years old. We have WordPress 4.1.1 I ...
Nora McDougall-Collins's user avatar
10 votes
2 answers
23k views

A check for if is parent page, if has children, if has grandchildren

I have one default page template that I wish to use for two scenarios. I'd prefer to use only one page template for the sake of simplicity for my client. Here's what I'm trying to accomplish: if ...
laura.f's user avatar
  • 191
1 vote
1 answer
1k views

Advanced or not so advanced pre_get_posts query

I would like to only show posts that have "now and future" children using pre_get_posts action hook. Does anyone have an idea of how to achieve this? function pre_get_posts($query) { if(!...
Kobus Beets's user avatar
-1 votes
1 answer
628 views

loop mix my child-category and parent-category

i explain the situatio I'm having: I have a blog, which on the homepage, have display the most recent post. For each post category, I have set up one specific color and icon by css. ex: for ...
tibewww's user avatar
  • 297
0 votes
1 answer
1k views

Nested custom post types templating

I have multiple custom post types which I nested thanks to a plugin and post I found. I have a custom post type 'landen' ( which should be the parent post type ) and a child post type 'rondreizen', ...
marciano's user avatar
0 votes
2 answers
2k views

Permalink for PDF of article

I'm trying to learn if this is possible, and how I might go about implementing it. Our site is a scientific journal, and our published articles follow this permalink structure: http://ehponline.org/&...
Hal Atkins's user avatar