14 Ağustos 2016 Pazar

wordpress breadcrumb php

Print the current post’s title
1
echo get_the_title();
Simple breadcrumb trail for pages, two levels deep.
1
2
3
4
5
6
7
8
9
10
11
echo '<div class="breadcrumb">';
    // If there is a parent, display the link.
    $parent_title = get_the_title( $post->post_parent );
 
    if ( $parent_title != the_title( ' ', ' ', false ) ) {
        echo '<a href="' . esc_url( get_permalink( $post->post_parent ) ) . '" alt="' . esc_attr( $parent_title ) . '">' . $parent_title . '</a> » ';
    }
 
    // Then go on to the current page link.
    echo '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark" alt="' . esc_attr( the_title_attribute() ) . '">' . the_title() . '</a>';
echo '</div>';

Hiç yorum yok:

Yorum Gönder