<?php comments_template(); ?>
/*
* Step 1. Add Link to My Account menu
*/
add_filter ( 'woocommerce_account_menu_items', 'misha_log_history_link', 40 );
function misha_log_history_link( $menu_links ){
$menu_links = array_slice( $menu_links, 0, 5, true )
+ array( 'log-history' => 'Log history' )
+ array_slice( $menu_links, 5, NULL, true );
return $menu_links;
}
/*
* Step 2. Register Permalink Endpoint
*/
add_action( 'init', 'misha_add_endpoint' );
function misha_add_endpoint() {
// WP_Rewrite is my Achilles' heel, so please do not ask me for detailed explanation
add_rewrite_endpoint( 'log-history', EP_PAGES );
}
/*
* Step 3. Content for the new page in My Account, woocommerce_account_{ENDPOINT NAME}_endpoint
*/
add_action( 'woocommerce_account_log-history_endpoint', 'misha_my_account_endpoint_content' );
function misha_my_account_endpoint_content() {
// of course you can print dynamic content here, one of the most useful functions here is
echo comments_template();
}
/*
* Step 4
*/
// Go to Settings > Permalinks and just push "Save Changes" button.
?><li <?php comment_class() ?> id="comment-<?php comment_ID() ?>">
<div class="comment-body">
<?php echo get_avatar( $comment, 70, '', '', array( 'class' => 'comment-avatar' ) ) ?>
<div class="comment-content">
<span class="comment-author"><?php comment_author() ?></span>
<span class="comment-date"><?php comment_date( 'j F Y в H:i' ) ?></span>
<?php comment_text() ?>
</div>
</div>
<?php // без закрывающего </li> (!)