Get a page’s schema and use on an archive or add parent CPT to breadcrumbs

#345393
  • Resolved adamnicolson
    Rank Math free

    Hi RankMath

    I have a custom post type and I would like to make its archives have more specific schema details.

    I had been using a page for the archive and I want to pull the schema details from this page and use it on the archive. I do this for the basic WP details like this


    $page_details = get_pages('meta_key=_wp_page_template&meta_value=page-solutions.php');
    $page = array_shift($page_details);

    but RankMath pulls the archive details schema onto the page, not the pages schema as I want.

    I’ve been able to get the details to pull through when I set my custom post type to "has_archive" => false, but this then makes the breadcrumbs on the sub posts for my CPT have no parent – just Home > Post-type-title rather than Home > Solutions > Post-type-title.

    It may be easiest to rewrite the breadcrumbs for the CPT. I can see this code here 4. Filter to change the Breadcrumb HTML but I don’t understand how I can use it to update the HTML output for the breadcrumbs.

    Any advice would be much appreciated,
    Adam

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Get a page’s schema and use on an archive or add parent CPT to breadcrumbs’ is closed to new replies.