Okay
  Public Ticket #965174
Breadcrumbs
Closed

Comments

  •  2
    Bob Felstead started the conversation

    When enabling breadcrumbs, the output is pulled from the Site Title in the Wordpress settings area. In my case this is 'Digital Marketing Solutions' which I would like to change to 'Home'

    I would like to do this without changing this within the Wordpress settings area. I can see that layouts/before.php is responsible for this setting and want to know how I can change this to output from 

    Digital Marketing Solutions --> Page name

    to

    Home --> Page name.

    Do I need to amend this php file or is there an easier method for doing so.

    Regards,

    Bob

  •  46
    Kris replied

    Hi,

    In file wp-content/themes/dp-click/dynamo_framework/helpers/helpers.layout.php  about line 470 you find function click_breadcrumbs_output()

    Please replace this function with this modified code :

    function click_breadcrumbs_output() {
        global $post;
        // open the breadcrumbs tag
        $output = '<p></p>
    <div class="click-breadcrumbs"><code>';
        // check if we are on the post or normal page
        if (!is_home()) {
            // return the Home link
            $output .= '<a href="' . esc_url( home_url('/')) . '" class="click-home">Home</a>';
            // if page is category or post
            if (is_category() || is_singular()) {
                // return the category link
                $output .= get_the_category_list(' ');
                // if it is a subpage
                if (is_page() && $post->post_parent ) {
                $output .= '<a href="' . get_permalink($post->post_parent) . '">' . get_the_title($post->post_parent) . '</a>';        
                }
                // if it is a post page
                if (is_singular()) {
                    // return link the name of current post
                    $output .= '<span class="click-current">' . get_the_title() . '</span>';
                }            
            // if it is a normal page
            } elseif (is_page()) { 
                // output the page name
                $output .= get_the_title('<span class="click-current">', '</span>');
            } elseif (is_tag() && isset($_GET['tag'])) {
                // output the tag name
                $output .= '<span class="click-current">' . esc_attr__('Tag: ', 'dp-click') . strip_tags($_GET['tag']) . '</span>';
            } elseif (is_author() && isset($_GET['author'])) {
                // get the author name
                $id = strip_tags($_GET['author']);
                if(is_numeric($id)) {
                    // output the author name
                    $output .= '<span class="click-current">' . esc_attr__('Published by: ', 'dp-click') . get_the_author_meta('display_name', $id) . '</span>';
                }
            } elseif(is_404()) {
                $output .= '<span class="click-current">' . esc_attr__('Page not found', 'dp-click') . '</span>';
            } elseif(is_archive()) {
                $output .= '<span class="click-current">' . esc_attr__('Archives', 'dp-click') . '</span>';
            } elseif(is_search() && isset($_GET['s'])) {
                // output the author name
                $output .= '<span class="click-current">' . esc_attr__('Searching for: ', 'dp-click') . strip_tags($_GET['s']) . '</span>';
            }
        // if the page is a home
        } else {
            // output the home link only
            $output .= '<a href="' . esc_url( home_url('/')) . '" class="click-home">Home</a>';
        }
        // close the breadcrumbs container
        $output .= '</code></div>
    <p><code>';</p>
    <p> echo apply_filters('click_breadcrumb', $output);<br>}<br></code></p>

    Thats all

    Kris

    DynamicPress Support Team