Skip to content

Instantly share code, notes, and snippets.

@Miq3l
Forked from mclanecreative/my-account.php
Last active September 2, 2015 17:17
Show Gist options
  • Save Miq3l/117267af3887788f017d to your computer and use it in GitHub Desktop.
Save Miq3l/117267af3887788f017d to your computer and use it in GitHub Desktop.
Adds Tabs to WooCommerce "My Account" page. Instructions: add my-account.php to your /woocommerce/myaccount/ folder. Next, add the CSS to your child theme's style.css file.
<?php
/**
* My Account page
*
* @author WooThemes
* @edited by McLane Creative
* @package WooCommerce/Templates
* @version 3.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
wc_print_notices(); ?>
<div class="container">
<div class="wc-account-tab">
<ul class="tabs">
<li>
<input type="radio" checked name="tabs" id="tab1">
<label for="tab1">Dashboard</label>
<div id="tab-content1" class="tab-content animated fadeIn">
<p class="myaccount_user">
<?php
printf(
__( 'Hello <strong>%1$s</strong> (not %1$s? <a href="%2$s">Sign out</a>).', 'woocommerce' ) . ' ',
$current_user->display_name,
wp_logout_url( get_permalink( wc_get_page_id( 'myaccount' ) ) )
);
printf( __( 'From your account dashboard you can view your recent orders, manage your shipping and billing addresses and <a href="%s">edit your password and account details</a>.', 'woocommerce' ),
wc_customer_edit_account_url()
);
?>
</p>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab2">
<label for="tab2">Downloads</label>
<div id="tab-content2" class="tab-content animated fadeIn">
<?php wc_get_template( 'myaccount/my-downloads.php' ); ?>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab3">
<label for="tab3">Orders</label>
<div id="tab-content3" class="tab-content animated fadeIn">
<?php wc_get_template( 'myaccount/my-orders.php', array( 'order_count' => $order_count ) ); ?>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab4">
<label for="tab4">Free Stuff</label>
<div id="tab-content4" class="tab-content animated fadeIn">
<p><a href="https://theyouthcartel.com/newsletter/youtube-you-can-use-archives/">YouTube You Can Use</a></p>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab5">
<label for="tab5">Edit Details</label>
<div id="tab-content5" class="tab-content animated fadeIn">
<?php wc_get_template( 'myaccount/my-address.php' ); ?>
</div>
</li>
</ul>
</div></div>
/*---- My Account Tabs ----------*/
.tabs {
width: 100%;
float: none;
list-style: none;
position: relative;
padding: 0;
margin-bottom: 5em;
}
.tabs li{
float: left;
}
.tabs label {
display: block;
padding: 10px 20px;
border-radius: 2px 2px 0 0;
color: #c60000;
font-size: 18px;
font-weight: normal;
background: rgba(255,255,255,0.2);
cursor: pointer;
position: relative;
top: 3px;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.tabs label:hover {
background: #e6b2b2;
top: 0;
}
[id^=tab]:checked + label {
background: #c60000;
color: white;
top: 0;
}
[id^=tab]:checked ~ [id^=tab-content] {
display: block;
}
.tab-content{
z-index: 2;
display: none;
text-align: left;
width: 100%;
line-height: 140%;
padding-top: 10px;
padding: 15px;
position: absolute;
left: 0;
box-sizing: border-box;
-webkit-animation-duration: 0.5s;
-o-animation-duration: 0.5s;
-moz-animation-duration: 0.5s;
animation-duration: 0.5s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment