Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #218296

    1. I’m using categories in my pages type
    2. Using blog grid element to display the grouping of these pages which are all in root (existing custom php site url structure)

    Would like to assign breadcrumb to get back to parent page.

    Structure like this:

    fruits.com/citrus is the blog grid displaying the top-level (no parent) pages example /oranges /lemons

    On the individual pages like /oranges the breadcrumb is
    Home > Oranges

    I would like to insert the Citrus page which I could set as a custom meta field in the page then retrieve into breadcrumb to get
    Home > Citrus > Oranges

    By making citrus parent of oranges this would work but it also changes the url so thats not an option

    Any ideas how to make this work?
    wp-content/themes/enfold/includes/helper-template-logic.php

    #218616

    Hello!

    It is possible but that customization is beyond the scope of the support we can offer.

    Alternatively, you can assign the parent and to fix the Permalinks ‘issue’ use this: http://wordpress.org/plugins/custom-permalinks/

    Cheers!
    Josue

    #218674

    Hi!

    You can try the code I posted here: https://kriesi.at/support/topic/breadcrumb-and-blog-title-formatting/#post-214336 – replace the id “20” with the id of your “Citrus” blog page.

    Best regards,
    Peter

    #218998

    Thank you Peter that function helped fix the missing blog breadcrumb when using the blog grid without ‘assigning’ a blog page.
    I modified it for use with ‘page’ post type. Now I can assign a ‘parent’ page breadcrumb to otherwise orphan pages.
    Thank you again Peter and team Kriesi your support is outstanding! and much appreciated!

    Here’s the code for for others wanting to set a page parent breadcrumb – put the desired parent page id in custom field named ‘parent_breadcrumb-postid’

    if(!function_exists('avia_modify_page_breadcrumb'))
    {
        function avia_modify_page_breadcrumb($trail)
        {
    
        	if(get_post_type() === "page" )
    		{
    			$pageid = get_field('parent_breadcrumb_postid');
    			if($pageid)
    			{
    				$page = '<a href="' . get_permalink( $pageid ) . '" title="' . esc_attr( get_the_title( $pageid ) ) . '">' . get_the_title( $pageid ) . '</a>';
    				array_splice($trail, 1, 0, array($page));
    			}
    
    		}
    
            return $trail;
        }
    
        add_filter('avia_breadcrumbs_trail','avia_modify_page_breadcrumb');
    }

    Let me know if you see any improvements.
    Cheers

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Add breadcrumb from 'parent' blog grid page’ is closed to new replies.