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 reflected in parent theme. I'm trying to change the code for feature image sizes. I successfully changed the code in parent to test it and it works. But child theme isn't overriding it. /public_html/wp-content/themes/sahifa/framework/functions/theme-functions.php /public_html/wp-content/themes/sahifa-child/framework/functions/theme-functions.php /public_html/wp-content/themes/sahifa/framework/parts/related-posts.php /public_html/wp-content/themes/sahifa-child/framework/parts/related-posts.php Other question I had was do I …
Category: Web

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 || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug ) and then added it as the following hook to my theme's functions.php. But for some reason, I just get a critical error: "Allowed memory size exhausted". What can I do to allow numeric slugs for child pages? add_filter( 'wp_unique_post_slug', function ( $slug, $post_ID, $post_status, …
Category: Web

How to populate a parent page with its child subpages and associated templates

I have a decent understanding of Wordpress as well as the Advanced Custom Fields Plugin and I'm trying to write my parent page template right now, but I'm having trouble trying to figure out how I can have my child pages appear in the parent page. The way my layout is set up, my parent page is filled with a whole bunch of different sections. Each section is created in the dashboard as a page and is associated with a …
Category: Web

Display title of child pages in shortcode

I'm having a hard time figuring out how to display the title of the childpages as the id of a div. Assuming that 'news' & 'othernews' are siblings of the parent page home (39) I want something like this: <div class="wrapper" id="news"> content </div> <div class="wrapper" id="othernews"> content </div> This is my function for my shortcode: function content_block( $atts, $content = null ){ extract( shortcode_atts( array( 'type' => 'white' ), $atts)); $childArgs = array( 'post_type' => 'page', 'parent_page' => 39 …
Category: Web

Wordpress child pages not working

I am creating a wordpress CMS and I have added multiple pages under one parent page. I am generating the links for all the child pages of a page and then when user clicks on the links, they should be able to open the child page. How ever when I click on the links, the index page is opened and no child page content is displayed. May be it is due to the use of the .htaccess file. I dont …
Category: Web

One set of Child Pages redirecting to Home page?

I've searched multiple forums, and not finding anything quite like this... On a site I manage, there are several parent pages with links to child pages embedded in images. Each image links to the corresponding child page without a problem. ONE of the parents pages, however, when I click on any of the images (or even try to manually direct to one of the child pages), it redirects to the homepage. I've read through the code several times and can't …
Category: Web

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 Root: Parent Page child 1 sub child a sub child b child 2 sub child a sub child b child 3 sub child a sub child b Note: (When I search anything Results comes only from their child and not from subpages) …
Category: Web

404 on child page template

I have a page called portfolio and I have created several child pages for it like Video page, audio page etc … I also created custom page template for portfolio and named its file portfolio-template-ahsan.php. But when I use it on my child page as a custom template, it gives me the 404 error page. Now what I am confused about is how this naming convention works, and how should I name the child custom page templates, if I remove …
Category: Web

Child pages and sub-pages do not appear. Why?

I have created a child page. However, when I access "http://example.com/Page/ChildPage" does not appear? Page (filename = page.php -> content-page.php) [WORK] Child Page (filename = page.php -> content-child-page.php) [NOT WORK] page.php $slug = get_post_field( 'post_name', get_post() ); echo $slug; while ( have_posts() ) : the_post(); get_template_part( 'template-parts/page/content' , $slug ); endwhile; // End of the loop.
Category: Web

List child pages, exclude the current page

I'm trying to display the child pages of a parent page, this is working. But when I tried to exclude the current page in the list where the child pages displayed, it's not working. How to fix this? $current_post_id = $post->ID; if(wp_list_pages("title_li=&child_of=2143&exclude='.$current_post_id.'")): if($title) echo $before_title . $title . $after_title; wp_list_pages("title_li=&child_of=2143&exclude='.$current_post_id.'"); endif;
Category: Web

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. All of my other Pages do show up in the dropdown menu. And in fact, these two missing top-level Pages are already parents to some of my other Pages. They used to appear in the dropdown, and the database still has their IDs saved. (I …
Category: Web

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 CPTs but when I visit a child post with a numeric slug it redirects to the parent post automatically. So for example I have a Programmes CPT. There is a parent program with the slug: programmes/city-in-visible/ and a child program with the slug: programmes/city-in-visible/2009/ Visiting programmes/city-in-visible/2009/ redirects to programmes/city-in-visible/ That should not happen. How can …
Category: Web

Check if is on child-page of a particular page

I am trying to output a logo depending on which page is being viewed. <?php if ( is_page('home') || is_page('services') ) { ?> <div class="col-md-2 col-sm-4"> <?php ci_e_logo('<h1 class="logo ' . get_logo_class() . '">', '</h1>'); ?> </div> <?php } else { ?> <div class="col-md-2 col-sm-4"> <h1 class="logo imglogo"> <a href="http://websiteaddress.com"> <img src="<?php echo get_bloginfo('template_directory');?>/images/picturehere.png" alt="title here"></a> </h1> </div> <?php } ?> The code above works fine, but how do apply the logo image swap on the sub-pages of the 'services'?
Category: Web

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/product-name-feature, it 404s. I originally tried giving the custom post type the rewrite slug as '/', and while this was great for the custom post type, it killed normal pages (404). So if the solution is to use '/' and then fix normal pages, that's fine too. // Post Type …
Category: Web

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 perfectly like this: However I want to use this as a template for multiple pages, but when I use the ID or get Id or echoing the ID, it also take the sibling pages of the parent page. Which I don't need. <?php wp_list_pages('child_of=the_ID()&sort_column=menu_order&title_li=') ?> I can't figure it out what I am …
Category: Web

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 every solution I could find on these forums and everytime I try to navigate to /page/child-page/page/2/ WordPress sends me back to /page/child-page/ with a 301 redirect. I have of course flushed the permalinks about 100 times. Here's the code I'm working with: <?php if ( get_query_var('paged') …
Category: Web

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. here, i need to load same template but with different content as per the parent url. Note: I need to show this as end result of hubspot form submission on different pages. do i need to create a page in admin area for that? do i need to set this page as a child? …
Category: Web

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 str_replace( '/category', '', $termlink ); } return $termlink; } add_filter( 'term_link', 'wpa_alter_cat_links', 10, 3 ); to change the Links for the Categories. I made Pages where Users can find the most important links on that Subject. I would like to have the last link, when there is no more child to the link still …
Category: Web

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: Publications -> Computers -> Article 123 So, once user enters "Article 123" page I would like to highlight "Publications" menu section. Is it possible?
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.