Commit f545fdba by Pham Huy

thêm main menu

parent b02b7f87
/* dscorp style custom */
.social ul.social-icons li a{
background-color: #840b25a6;
}
.social ul.social-icons li a:hover,
.plubication-downloads h2,
.news .blog-date,
footer .footer{
background-color: #840b25;
}
footer .copyright{
background-color: #5d0619;
}
ul.main-menu li a:hover, ul.main-menu li.active > a{
color: #840b25;
}
a, h2.title-2, .top-info h3,
h4.subtitle, .stats-info h4.counter,
h4.client-name, .panel-default>.panel-heading a,
.skill-bar-percent, .download-file a,
.blog-content h3 a:hover, .blog-content a{
color: #840b25;
}
ul.download-list li{
color: #677078;
}
.panel-default>.panel-heading a:hover, .blog-content a:hover{
color: #5d0619;
}
/* button color */
.btn-primary, .btn-primary.active, .btn-primary:active, .open>.dropdown-toggle.btn-primary,
.btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover,
.btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover,
.open>.dropdown-toggle.btn-primary.focus, .open>.dropdown-toggle.btn-primary:focus, .open>.dropdown-toggle.btn-primary:hover{
background-color: #e81f18;
}
.btn-primary:hover {
background-color: #840b25;
}
.links .btn-primary:hover{
background-color: #840b25;
}
\ No newline at end of file
......@@ -57,7 +57,7 @@
<div class="row widgets">
<div class="col-md-4 col-sm-6">
<div class="about-txt widget">
<img src="<?php echo get_template_directory_uri();?>/images/footer-logo.png" alt="logo" />
<?php twentysixteen_the_custom_logo(); ?>
<p>Collaboratively deliver partnerships progressive alignments. Assertively premier supply chains before emerging solutions. Monetize high-payoff action items before wireless internal or "organic" sources exceptional action items. </p>
......
......@@ -586,12 +586,12 @@ function dscorp_style() {
* Nếu sử dụng child theme, thì file style.css này vẫn load ra từ theme mẹ
*/
wp_register_style( 'main-bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', 'all' );
wp_register_style( 'main-style', get_template_directory_uri() . '/css/dscorp-style.css', 'all' );
wp_register_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css', 'all' );
wp_register_style( 'owl-carousel', get_template_directory_uri() . '/css/owl.carousel.min.css', 'all' );
wp_register_style( 'owl-theme', get_template_directory_uri() . '/css/owl.theme.min.css', 'all' );
wp_register_style( 'font-awesome', get_template_directory_uri() . '/fonts/font-awesome/css/font-awesome.min.css', 'all' );
wp_register_style( 'style-dscorp', get_template_directory_uri() . '/css/style.css', 'all' );
wp_register_style( 'main-style', get_template_directory_uri() . '/css/dscorp-style.css', 'all' );
wp_register_script('main-jquery', get_template_directory_uri() . '/js/jquery.min.js', array('jquery'),'3.3', true);
wp_register_script('main-bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'),'3.3', true);
......@@ -605,13 +605,13 @@ function dscorp_style() {
wp_register_script('waypoints-js', get_template_directory_uri() . '/js/waypoints.min.js', array('jquery'),'3.3', true);
wp_register_script('main-js', get_template_directory_uri() . '/js/main.js', array('jquery'),'3.3', true);
wp_enqueue_style( 'main-style' );
wp_enqueue_style( 'main-bootstrap' );
wp_enqueue_style( 'owl-carousel' );
wp_enqueue_style( 'owl-theme' );
wp_enqueue_style( 'flexslider' );
wp_enqueue_style( 'font-awesome' );
wp_enqueue_style( 'style-dscorp' );
wp_enqueue_style( 'main-style' );
wp_enqueue_script( 'main-jquery' );
wp_enqueue_script( 'main-bootstrap-js' );
......@@ -626,3 +626,271 @@ function dscorp_style() {
wp_enqueue_script( 'main-js' );
}
add_action( 'wp_enqueue_scripts', 'dscorp_style' );
/**
* Tạo menu theo template
*/
function create_bootstrap_menu( $theme_location ) {
$menu_name = $theme_location;
if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {
$menu = wp_get_nav_menu_object( $locations[ $menu_name ] );
$menu_items = wp_get_nav_menu_items($menu->term_id);
$menu_list = '';
$menu_list = '<nav id="navbar" class="collapse navbar-collapse main-menu">' ."\n";
$menu_list .= '<div class="container">' ."\n";
$menu_list .= '<ul class="main-menu">' ."\n";
$count = 0;
$submenu = false;
$cpi = get_the_id();
foreach( $menu_items as $current ) {
if($cpi == $current->object_id ){
if ( !$current->menu_item_parent ) {
$cpi = $current->ID;
}else{
$cpi = $current->menu_item_parent;
}
$cai = $current->ID;
break;
}
}
foreach( $menu_items as $menu_item ) {
$link = $menu_item->url;
$title = $menu_item->title;
$menu_item->ID == $cai ? $ac2 = ' current_menu' : $ac2 = '';
if ( !$menu_item->menu_item_parent ) {
$parent_id = $menu_item->ID;
$parent_id==$cpi ? $ac=' current_item' : $ac='';
if(!empty($menu_items[$count + 1]) && $menu_items[ $count + 1 ]->menu_item_parent == $parent_id ){//Checking has child
$menu_list .= '<li class="dropdown has_child'.$ac.'"><a href="'.$link.'" data-toggle="dropdown">'.$title.'<i class="fa fa-chevron-down dropdown-toggle"></i></a>';
}else{
$menu_list .= '<li class="'.$ac.'">' ."\n";
$menu_list .= '<a href="'.$link.'" class="'.$ac2.'">'.$title.'</a>' ."\n";
}
}
if ( $parent_id == $menu_item->menu_item_parent ) {
if ( !$submenu ) {
$submenu = true;
$menu_list .= '<ul>' ."\n";
}
$menu_list .= '<li>' ."\n";
$menu_list .= '<a href="'.$link.'" class="'.$ac2.'">'.$title.'</a>' ."\n";
$menu_list .= '</li>' ."\n";
if(empty($menu_items[$count + 1]) || $menu_items[ $count + 1 ]->menu_item_parent != $parent_id && $submenu){
$menu_list .= '</ul>' ."\n";
$submenu = false;
}
}
if (empty($menu_items[$count + 1]) || $menu_items[ $count + 1 ]->menu_item_parent != $parent_id ) {
$menu_list .= '</li>' ."\n";
$submenu = false;
}
$count++;
}
$menu_list .= '</ul>' ."\n";
$menu_list .= '</div><!-- /.container -->' ."\n";
$menu_list .= '</nav>' ."\n";
} else {
$menu_list = '<li>Menu "' . $menu_name . '" not defined.</li>';
}
echo $menu_list;
}
/**
* Breadcrumbs customize
*/
function get_customize_breadcrumbs()
{
// Set variables for later use
$here_text = __( 'You are currently here!' );
$home_link = home_url('/');
// $home_text = __( 'Home' );
$home_text = 'Home';
$link_before = '<span typeof="v:Breadcrumb">';
$link_after = '</span>';
$link_attr = ' rel="v:url" property="v:title"';
$link = $link_before . '<a' . $link_attr . ' href="%1$s">%2$s</a>' . $link_after;
$delimiter = ' <i class="fa fa-chevron-right"></i> '; // Delimiter between crumbs
$before = '<span class="current">'; // Tag before the current crumb
$after = '</span>'; // Tag after the current crumb
$page_addon = ''; // Adds the page number if the query is paged
$breadcrumb_trail = '';
$category_links = '';
/**
* Set our own $wp_the_query variable. Do not use the global variable version due to
* reliability
*/
$wp_the_query = $GLOBALS['wp_the_query'];
$queried_object = $wp_the_query->get_queried_object();
// Handle single post requests which includes single pages, posts and attatchments
if ( is_singular() )
{
/**
* Set our own $post variable. Do not use the global variable version due to
* reliability. We will set $post_object variable to $GLOBALS['wp_the_query']
*/
$post_object = sanitize_post( $queried_object );
// Set variables
$title = apply_filters( 'the_title', $post_object->post_title );
$parent = $post_object->post_parent;
$post_type = $post_object->post_type;
$post_id = $post_object->ID;
$post_link = $before . $title . $after;
$parent_string = '';
$post_type_link = '';
if ( 'post' === $post_type )
{
// Get the post categories
$categories = get_the_category( $post_id );
if ( $categories ) {
// Lets grab the first category
$category = $categories[0];
$category_links = get_category_parents( $category, true, $delimiter );
$category_links = str_replace( '<a', $link_before . '<a' . $link_attr, $category_links );
$category_links = str_replace( '</a>', '</a>' . $link_after, $category_links );
}
}
if ( !in_array( $post_type, ['post', 'page', 'attachment'] ) )
{
$post_type_object = get_post_type_object( $post_type );
$archive_link = esc_url( get_post_type_archive_link( $post_type ) );
$post_type_link = sprintf( $link, $archive_link, $post_type_object->labels->singular_name );
}
// Get post parents if $parent !== 0
if ( 0 !== $parent )
{
$parent_links = [];
while ( $parent ) {
$post_parent = get_post( $parent );
$parent_links[] = sprintf( $link, esc_url( get_permalink( $post_parent->ID ) ), get_the_title( $post_parent->ID ) );
$parent = $post_parent->post_parent;
}
$parent_links = array_reverse( $parent_links );
$parent_string = implode( $delimiter, $parent_links );
}
// Lets build the breadcrumb trail
if ( $parent_string ) {
$breadcrumb_trail = $parent_string . $delimiter . $post_link;
} else {
$breadcrumb_trail = $post_link;
}
if ( $post_type_link )
$breadcrumb_trail = $post_type_link . $delimiter . $breadcrumb_trail;
if ( $category_links )
$breadcrumb_trail = $category_links . $breadcrumb_trail;
}
// Handle archives which includes category-, tag-, taxonomy-, date-, custom post type archives and author archives
if( is_archive() )
{
if (is_category() || is_tag() || is_tax() ) {
// Set the variables for this section
$term_object = get_term( $queried_object );
$taxonomy = $term_object->taxonomy;
$term_id = $term_object->term_id;
$term_name = $term_object->name;
$term_parent = $term_object->parent;
$taxonomy_object = get_taxonomy( $taxonomy );
// $current_term_link = $before . $taxonomy_object->labels->singular_name . ': ' . $term_name . $after;
$current_term_link = $before . $term_name . $after;
$parent_term_string = '';
if ( 0 !== $term_parent )
{
// Get all the current term ancestors
$parent_term_links = [];
while ( $term_parent ) {
$term = get_term( $term_parent, $taxonomy );
$parent_term_links[] = sprintf( $link, esc_url( get_term_link( $term ) ), $term->name );
$term_parent = $term->parent;
}
$parent_term_links = array_reverse( $parent_term_links );
$parent_term_string = implode( $delimiter, $parent_term_links );
}
if ( $parent_term_string ) {
$breadcrumb_trail = $parent_term_string . $delimiter . $current_term_link;
} else {
$breadcrumb_trail = $current_term_link;
}
} elseif ( is_author() ) {
$breadcrumb_trail = __( 'Author archive for ') . $before . $queried_object->data->display_name . $after;
} elseif ( is_date() ) {
// Set default variables
$year = $wp_the_query->query_vars['year'];
$monthnum = $wp_the_query->query_vars['monthnum'];
$day = $wp_the_query->query_vars['day'];
// Get the month name if $monthnum has a value
if ( $monthnum ) {
$date_time = DateTime::createFromFormat( '!m', $monthnum );
$month_name = $date_time->format( 'F' );
}
if ( is_year() ) {
$breadcrumb_trail = $before . $year . $after;
} elseif( is_month() ) {
$year_link = sprintf( $link, esc_url( get_year_link( $year ) ), $year );
$breadcrumb_trail = $year_link . $delimiter . $before . $month_name . $after;
} elseif( is_day() ) {
$year_link = sprintf( $link, esc_url( get_year_link( $year ) ), $year );
$month_link = sprintf( $link, esc_url( get_month_link( $year, $monthnum ) ), $month_name );
$breadcrumb_trail = $year_link . $delimiter . $month_link . $delimiter . $before . $day . $after;
}
} elseif ( is_post_type_archive() ) {
$post_type = $wp_the_query->query_vars['post_type'];
$post_type_object = get_post_type_object( $post_type );
$breadcrumb_trail = $before . $post_type_object->labels->singular_name . $after;
}
}
// Handle the search page
if ( is_search() ) {
$breadcrumb_trail = __( 'Search query for: ' ) . $before . get_search_query() . $after;
}
// Handle 404's
if ( is_404() ) {
$breadcrumb_trail = $before . __( 'Error 404' ) . $after;
}
// Handle paged pages
if ( is_paged() ) {
$current_page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : get_query_var( 'page' );
$page_addon = $before . sprintf( __( ' ( Page %s )' ), number_format_i18n( $current_page ) ) . $after;
}
$breadcrumb_output_link = '';
$breadcrumb_output_link .= '<div class="breadcrumb">';
if ( is_home() || is_front_page() ) {
// Do not show breadcrumbs on page one of home and frontpage
if ( is_paged() ) {
// $breadcrumb_output_link .= $here_text . $delimiter;
$breadcrumb_output_link .= '<a href="' . $home_link . '">' . $home_text . '</a>';
$breadcrumb_output_link .= $page_addon;
}
} else {
// $breadcrumb_output_link .= $here_text . $delimiter;
$breadcrumb_output_link .= '<a href="' . $home_link . '" rel="v:url" property="v:title">' . $home_text . '</a>';
$breadcrumb_output_link .= $delimiter;
$breadcrumb_output_link .= $breadcrumb_trail;
$breadcrumb_output_link .= $page_addon;
}
$breadcrumb_output_link .= '</div><!-- .breadcrumbs -->';
return $breadcrumb_output_link;
}
......@@ -86,9 +86,10 @@
</div>
</div>
</div>
<?php create_bootstrap_menu("primary"); ?>
<!-- Main Navigation Section -->
<nav id="navbar" class="collapse navbar-collapse main-menu">
<!-- <nav id="navbar" class="collapse navbar-collapse main-menu">
<div class="container">
<ul class="main-menu">
<li class="active"> <a href="index.html"> Home </a></li>
......@@ -127,7 +128,7 @@
<li><a href="contact.html"> CONTACT </a> </li>
</ul>
</div>
</nav>
</nav> -->
</div>
</header>
......
......@@ -82,7 +82,7 @@ get_header();
<p> Proactively incubate enterprise total linkage without sustainable leadership skills. Monotonectally strategize user-centric interfaces whereas low-risk high-yield materials. Efficiently syndicate web-enabled portals for principle centered partnerships.
</p>
<p>Proactively whiteboard revolutionary processes after scalable testing procedures. Holisticly reinvent seamless after business.</p>
<h4 class="ceo-sign"> <img src="<?php echo get_template_directory_uri();?>/images/ceo-sign.png" alt="signature" /> </h4>
<h4 class="ceo-sign"> <img src="<?php echo get_template_directory_uri();?>/images/ceo-sign-dscorp.png" alt="signature" /> </h4>
<p class="ceo-name">Gregory Walker, CEO</p>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment