Share parent path between Custom Post Types and Pages?

Here’s my situation: I have a custom post type I created called “professions” with three professions (“military”, “firefighters”, “law-enforcement”). I created a page single-professions.php to use as the post page. I set the slug to “heroes” in my register_post_type function: ‘rewrite’ => array( ‘slug’ => ‘heroes’, ‘with_front’ => false ) Here are the full options … Read more

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 “https://wordpress.stackexchange.com/”, and while this was great for the custom post … Read more

Custom post type hierarchical permalinks not behaving as expected for parent/child pages

When you have Pages with children, the permalink structure works something like this: example.com/parent-page/child-page/ All well and good. Trying to go to this URL: example.com/child-page/ doesn’t work, which is good, and as expected – I only want the one URL for my child page. However, I’ve set up a custom post type, and set it … Read more

query attachment images … if no attachments -> get attachments of parent page?

I use this to query all attachments of the current page or post I’m on … $query_images_args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ =>’image’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => -1, ‘post_parent’ => $post->ID //$post->post_parent ); $attachments = get_children($query_images_args); if ( empty($attachments) ) { $query_images_args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ =>’image’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ … Read more

Paginate Child Pages Content on Parent Page

I am using the following code to display child page content on it’s parent page. The code is working great, but it currently only shows the latest two child page posts, is there any way to display all of them and then add pagination to navigate through them? <?php $pages = get_pages(‘child_of=”.$post->ID.”&sort_column=post_date&sort_order=desc’); $count = 0; … Read more