Multiple Conditions for Child Page Title

I’ve been trying to work with Conditional Tags and cannot wrap my head around this problem. PHP novice here. On sub-pages I need to display the parent page title as well as the page title. I have it working with this: <h1><?php echo get_the_title($post->post_parent);?></h1> <h2><?php the_title(); ?></h2> But the problem I have now is that … Read more

Javascript that will execute on only child pages of a specific parent

Semi-new to WordPress, so apologies is this is an obvious question! I’m trying to execute some JavaScript on a WordPress site, but only on the child pages of a specific parent page – so, I have example.com/books, and I want the script to run on example.com/books/foo, example.com/books/bar, example.com/books/wee, and so forth. I don’t want it … Read more

inserting custom li class to wp_list_pages

I currently have a parent page with some child pages. I am able to list these child pages but would like to insert a custom li class. The wp_list_pages outputs <li class=”page-item number”></li>. I would like for it to output <li class=”hvr-underline”></li>. Here is the code I have so far: $children = wp_list_pages( ‘title_li=&child_of=”.$post->ID.”&echo=0’ ); … Read more

Does WordPress automatically redirect url without parent slug?

I inherited admin duties for my organization’s site. Ive noticed that if I enter a url with a child slug only (and drop the parent) it seems to redirect to the full url. Ex: www.example.com/child-page goes to www.example.com/parent-page/child-page Is this a standard WordPress feature? I’m basically wondering if I can give people the short version … Read more