Questions tagged [child-pages]
The child-pages tag has no usage guidance.
291
questions
1
vote
1
answer
30
views
Append a code when at the current page in wp_list_pages()
I'm using wp_list_pages() to show pages and subpages in a tree view and I need to add a "read more" as a sub-item right after the current page.
Example:
We are at the "Page tree"
...
0
votes
1
answer
59
views
complex get_posts() query to select child pages
I have pages on 2 levels under the main deparments page like below.
Departments
--Department 1
-----Course 1
-----Course 2
--Department 1
-----Course 3
-----Course 4
--Department 3
--Department ...
1
vote
1
answer
106
views
How to add numeric slug for child page in WordPress 5.9?
I am trying to configure WordPress 5.9 to allow numeric slugs for child pages. Drawing from the 2015 answer to a similar question I took the up-to-date code of wp_unique_post_slug, removed || ...
0
votes
0
answers
22
views
Search anything from a Child and Sub-Pages of their Parent page
I am trying to search and want to get results only from the Child - Sub Pages of their parent page. In the following code, I just get results from child pages, not subpages. Please help
Understand the ...
1
vote
0
answers
14
views
Child post with numeric only slug keeps redirecting to parent
I modified the allow-numeric-stubs plugin code to work with CPTs. You can view my forked repository here: https://github.com/akshatkedia/allow-numeric-stubs
WordPress is now allowing numeric slugs for ...
1
vote
1
answer
30
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 ...
1
vote
2
answers
362
views
Pagination of a WP_Query Loop in a child-page page template
See edit at bottom.
I have a wp_query loop in a page template for a custom post type ("success_stories"). The loop itself works fine but I cannot seem to get pagination working. I've tried ...
1
vote
1
answer
55
views
load common thank you template with different content for different pages
i have created a template called thank-you.php and inside that i want to show different content as per the parent url. for e.g. mywebsite.com/page/thank-you and mywebsite.com/another-page/thank-you. ...
0
votes
0
answers
26
views
Show Pages for all Category Links but not for Childless Categories
i can rewrite Category base in Permalink Settings or use
function wpa_alter_cat_links( $termlink, $term, $taxonomy ){
if( 'category' == $taxonomy && 0 == $term->parent ){
return ...
0
votes
1
answer
26
views
How to highlight 1st level menu item based on actual page
I am trying to highlight 1st level menu item by adding 'current-menu-item' class using nav_menu_css_class filter based on actual page / article / post / etc.
For example, menu looks like this:
...
1
vote
1
answer
69
views
List child pages of current page but limit to specific year
I have an old site that has sooo many child pages that I'd like to limit the return of child pages on a current page to just a specific year so that I can pull each year into an accordion.
I am ...
1
vote
1
answer
186
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 ...
0
votes
1
answer
140
views
Check if parent page has child page of certain slug
I currently have a function that checks to see if the page is a parent, and if so, do stuff. But I also want to check to see if the parent has a child page that has a certain slug.
Basically, how ...
0
votes
1
answer
20
views
Show child by slug, while knowing parent ID
Im trying this to show My CurrentPage (Licenciatura en Ciencias del Arte y Gestión Cultural.) child called "Infraestructura" by it's slug. I don't know whats wrong with my code. It Returns ...
1
vote
0
answers
26
views
Verify if the current page has at least one published child
In my theme php page template, I need to echo a string only if the page has at least one published child page. Actually, I have a function that verifies if the current page has any children, ...
0
votes
1
answer
186
views
Page access only from a specific page in wordpress website
I would like to know if it possible to have a page that open if and only if the visitor comes from a specific page (which in my case would be the homepage).
So for example, the visitors land on the ...
0
votes
1
answer
299
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,
...
1
vote
1
answer
399
views
Next and Previous Posts of Same Parent
I'm working on a website for a webcomic and I have a custom post type set up for comic pages. I have multiple series on the site and have made each comic page a child post of a parent (one parent for ...
0
votes
1
answer
660
views
Child Theme not overwriting Parent theme php file
I'm new to Wordpress and how Child themes work. My child theme I am trying to overwrite two files in sub-directories. I've copied the parent files and edited them in child theme but changes are not ...
0
votes
1
answer
29
views
How do I find out which (page) template file my custom child post is looking for?
I am trying to make something like a web-app with WP. One of the issues I'm facing now is that I cannot find out which page template file my post is looking for. I have looked at template file ...
0
votes
1
answer
349
views
How to get an array of pages ID by some page's slug and all its children pages in get_posts() function?
I have a custom function in my theme that creates a dynamic sitemap.xml file.
For that I'm using $myVar = get_posts( array(...) ). In that array I need to exclude some pages.
I want to exclude some ...
1
vote
1
answer
1k
views
select a private page as parent for another private page
I am trying to build a customer portal however the private page is not showing in the parent drop-down (The drop-down at the right bottom of page settings under page attributes). Both the parent and ...
4
votes
2
answers
796
views
Some pages are missing from the Parent Page select in the Editor
Two of my top-level Pages, and all of their children, are missing from the dropdown menu in the Block Editor for selecting a Parent Page.
There are no special characters in the titles or permalinks. ...
0
votes
1
answer
57
views
Return true if parent page id matches
I'm trying to write a function (with little luck) that does a simple check against the top level parent page and returns true if the ID matches a supplied ID number.
For example; If I'm on page ...
0
votes
1
answer
57
views
Only one parent page showing
I'm working with the Incubator theme. I have created two other parent pages but they come up blank, with no content.
The only way they show content is if I set them, one at a time, as the homepage in ...
1
vote
1
answer
375
views
Need wp_query to return all children and grandchildren
I am working on a site with three different main 'topevel' sections, that act as the top level parents of the site.
Each toplevel section has children and grandchildren, and there needs to be a ...
0
votes
1
answer
125
views
Return value of get_permalink(0) and get_the_title(0)
I'm new to wordpress and I'm following a tutorial right now but I don't understand wordpresses behaviour. I'm trying to change the title of a sidebar which lists the parentpage and it's childpages, ...
0
votes
1
answer
76
views
Hide BBPress create topic on one page
Hi sorry this is really basic question. I was just starting to explore wordpress and bbpress, I have a page with the forum index using the shortcode, when I enter a forum it has all the topics and the ...
0
votes
0
answers
55
views
How to use POST method using custom wordpress button?
everyone!
I'm pretty new to wordpress development, and right now i'm trying develop a small ecommerce site using some wordpress plugins and some php on my part.
Right now i'm in the middle of ...
0
votes
1
answer
270
views
How to get child pages and add unique class only to active page?
I have a parent page with child pages. How to get child pages and add unique class only to active page ?
I am making a sidebar with children's menu parent page one level up.
I can list all child ...
1
vote
1
answer
591
views
Allow users to publish child pages of the pages they have access to edit
I have created a custom role called Custom Author. Users in this role can edit their own pages and add new pages. I would like to restrict new page creation and allow Custom Authors to create pages ...
0
votes
1
answer
355
views
How to Display Shortcode in the correct location, currently displaying before content after Page Title?
I am having an issue displaying the shortcode in the correct location when using a display child pages query.
Can someone fix this for me? Thank you!
function show_product_pages() {
global $...
2
votes
2
answers
329
views
Remove custom post type slug not working for child pages
I'd like my custom post type, products, to not use a slug, eg: domain.com/product-name. The code below sorts that out nicely, however it fails to work with child pages, eg: domain.com/product-name/...
1
vote
1
answer
167
views
How to get specified parent page title in my function
Below I have a function that prints the child pages of a parent. I am trying to obtain the specified parent pages title as a h2 above the unordered list.
I have tried updating the title_li and also ...
1
vote
1
answer
1k
views
List child pages of specific page using shortcode
I have written the function below to list the current pages child pages. Now what I am trying to do is list the children of a specific page using its slug in the shortcode.
Is it possible to sneak an ...
0
votes
0
answers
37
views
Standard Page Child of CPT Not Found (404)
I am about to lose my mind figuring this out. I have a custom post type called "portal" and posts of that type can be the parent of a standard page. To accomplish that I've written code that adds the ...
0
votes
3
answers
380
views
WP_Query returns different results from get_posts() [closed]
So I have two code snippets, trying to get the child pages of the current page. The current page is "Sample", and the following code lives in page-sample.php.
The first snippet uses get_posts()
$...
0
votes
1
answer
41
views
Creating navigation out of specific IDs and their children?
I'm looking for a way to list three specific pages in a nav-menu (I want to get these pages by their unique page ID's), and also list the children of these three pages - appended to each list item, in ...
2
votes
1
answer
323
views
Query children and parent title
i'm query child pages of a page ID. How can i echo the parent page where it says "PARENT TITLE ? Using <?php echo get_the_title( $ID ); ?> is not an option.
<?php
$args = array(
'...
0
votes
1
answer
257
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 ...
0
votes
1
answer
338
views
Create a list of pages excluding children of selected page
I am looking to find a way to create a list of the IDs of children pages from a selected page.
My goal is to use the list of IDs so that I can exclude them from the following function:
wp_list_pages(...
1
vote
0
answers
16
views
How to display all subpages and short by year
How can I display all child-pages and short by year in Wordpress
For example:
all subpages in 2016, 2017, 2018:
• 2018:
----- Subpage A
----- Subpage B
----- Subpage C
• 2017:
----- ...
0
votes
1
answer
84
views
WordPress Betheme: Unkown subheader image of a child page
I want to get the URL of the Muffin Betheme subheader image of a child page, in the parent one, for each of its children.
Thus, I go through the children, then I try to get the subheader image for ...
0
votes
0
answers
22
views
How do I list subpages in post editor view?
I have many pages, each with many subpages nested up to 5 levels deep. In order to find a specific page in the administration panel, I can search for it on the list of all pages. The search results ...
0
votes
1
answer
41
views
If page or sub page not working as expected
I would like to display a specific dynamic sidebar the the "about" page and its children. From the codex, I have tried the following:
<?php
// Begin main loop
if ( have_posts() ): while ( ...
1
vote
2
answers
53
views
How to show child page without providing ID so it's dynamic
So this is my code. This piece of code shows me the child page titles.
But i'm providing the ID from the parent page. Is there a way to make this dynamic? I don't want to use the ID cuz then its ...
0
votes
1
answer
1k
views
Get Top parent url
I have the following structure:
TOP PAGE
SUB PAGE 1
--- SUB SUB PAGE 1
--- SUB SUB SUB PAGE 1
---- SUB SUB SUB SUB PAGE 1
--- SUB SUB SUB PAGE 1
--- SUB SUB SUB PAGE 1
---- SUB SUB SUB SUB PAGE 1
...
1
vote
1
answer
67
views
Child theme does not load all style
I know this thing has been posted several times now, but I can't figure it out. I am asking for your help. I have created theme child before, for other WordPress themes, but this one is giving me hard ...
2
votes
2
answers
646
views
Get custom field value from Grandparent Page for Parent and Child Pages
I've created the following pages and hierarchy:
Grandparent
Parent
Parent
Parent
Child
Child
Child
Parent
Parent
Grandparent
The Grandparent pages have an ACF custom field to pick the colour.
I'...
1
vote
1
answer
122
views
Programmatically add existing pages and subpages to Appearance Menu
I have inherited a site with over 600 pages/subpages. I plan to use a plugin to change the way the navigation displays but it requires the pages to be in the Appearance -> Menu in this page: /wp-admin/...