Update HTML attribute order

This commit is contained in:
Max Myers 2016-11-01 12:13:23 -04:00
parent 8f973a3525
commit d0c0cddfc1
24 changed files with 296 additions and 297 deletions

View File

@ -8,13 +8,13 @@
?>
<div class="wrapper" id="404-wrapper">
<div id="content" class="container">
<div class="container" id="content">
<div class="row">
<div id="primary" class="content-area">
<div class="content-area" id="primary">
<main id="main" class="site-main" role="main">
<main class="site-main" id="main" role="main">
<section class="error-404 not-found">

View File

@ -12,13 +12,13 @@
<div class="wrapper" id="archive-wrapper">
<div id="content" class="container">
<div class="container" id="content">
<div class="row">
<div id="primary" class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area">
<div class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area" id="primary">
<main id="main" class="site-main" role="main">
<main class="site-main" id="main" role="main">
<?php if ( have_posts() ) : ?>

View File

@ -11,13 +11,13 @@
<div class="wrapper" id="author-wrapper">
<div id="content" class="container">
<div class="container" id="content">
<div class="row">
<div id="primary" class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area">
<div class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area" id="primary">
<main id="main" class="site-main" role="main">
<main class="site-main" id="main" role="main">
<header class="page-header author-header">
@ -53,7 +53,7 @@
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<li>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
<a rel="bookmark" href="<?php the_permalink() ?>" title="Permanent Link: <?php the_title(); ?>">
<?php the_title(); ?></a>,
<?php the_time('d M Y'); ?> in <?php the_category('&');?>
</li>

View File

@ -18,7 +18,7 @@ if ( post_password_required() ) {
}
?>
<div id="comments" class="comments-area">
<div class="comments-area" id="comments">
<?php // You can start editing here -- including this comment! ?>
@ -31,7 +31,7 @@ if ( post_password_required() ) {
</h2>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<nav id="comment-nav-above" class="comment-navigation" role="navigation">
<nav class="comment-navigation" id="comment-nav-above" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'understrap' ); ?></h1>
<?php if ( get_previous_comments_link() ) { ?>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'understrap' ) ); ?></div>
@ -51,7 +51,7 @@ if ( post_password_required() ) {
</ol><!-- .comment-list -->
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<nav id="comment-nav-below" class="comment-navigation" role="navigation">
<nav class="comment-navigation" id="comment-nav-below" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'understrap' ); ?></h1>
<?php if ( get_previous_comments_link() ) { ?>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'understrap' ) );?></div>

View File

@ -6,7 +6,7 @@
*
* @package understrap
*/
$the_theme = wp_get_theme();
?>
@ -20,12 +20,12 @@
<div class="col-md-12">
<footer id="colophon" class="site-footer" role="contentinfo">
<footer class="site-footer" id="colophon" role="contentinfo">
<div class="site-info">
<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'understrap' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'understrap' ), 'WordPress' ); ?></a>
<span class="sep"> | </span>
<?php printf( __( 'Theme: %1$s by %2$s.', 'understrap' ), $the_theme->get( 'Name' ), '<a href="http://understrap.com/" rel="designer">understrap.com</a>' ); ?>
<?php printf( __( 'Theme: %1$s by %2$s.', 'understrap' ), $the_theme->get( 'Name' ), '<a rel="designer" href="http://understrap.com/">understrap.com</a>' ); ?>
(<?php printf( __( 'Version: %1$s', 'understrap' ), $the_theme->get( 'Version' ) ); ?>)
</div><!-- .site-info -->

View File

@ -23,7 +23,7 @@
<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<div class="hfeed site" id="page">
<!-- ******************* The Navbar Area ******************* -->
<div class="wrapper-fluid wrapper-navbar" id="wrapper-navbar">
@ -37,11 +37,11 @@
<div class="navbar-header">
<!-- .navbar-toggle is used as the toggle for collapsed navbar content -->
<button class="navbar-toggler hidden-sm-up" type="button" data-toggle="collapse" data-target=".exCollapsingNavbar" aria-controls="exCollapsingNavbar" aria-expanded="false" aria-label="Toggle navigation">&#9776;</button>
<button class="navbar-toggler hidden-sm-up" data-toggle="collapse" data-target=".exCollapsingNavbar" type="button" aria-controls="exCollapsingNavbar" aria-expanded="false" aria-label="Toggle navigation">&#9776;</button>
<!-- Your site title as branding in the menu -->
<?php if (!has_custom_logo()) { ?>
<a class="navbar-brand" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
<a class="navbar-brand" rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
<?php bloginfo( 'name' ); ?>
</a>
<?php } else { the_custom_logo(); } ?><!-- end custom logo -->

View File

@ -1,127 +1,127 @@
<?php
//Based on Jeff Hays code and his article here: http://robido.com/wordpress/wordpress-gallery-filter-to-modify-the-html-output-of-the-default-gallery-shortcode-and-style/
//Based on Jeff Hays code and his article here: http://robido.com/wordpress/wordpress-gallery-filter-to-modify-the-html-output-of-the-default-gallery-shortcode-and-style/
// Custom filter function to modify default gallery shortcode output
function bootstrap_wp_gallery( $output, $attr ) {
// Initialize
global $post, $wp_locale;
// Initialize
global $post, $wp_locale;
// Gallery instance counter
static $instance = 0;
$instance++;
// Gallery instance counter
static $instance = 0;
$instance++;
// Validate the author's orderby attribute
if ( isset( $attr['orderby'] ) ) {
$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
if ( ! $attr['orderby'] ) unset( $attr['orderby'] );
}
// Validate the author's orderby attribute
if ( isset( $attr['orderby'] ) ) {
$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
if ( ! $attr['orderby'] ) unset( $attr['orderby'] );
}
// Get attributes from shortcode
extract( shortcode_atts( array(
'order' => 'ASC',
'orderby' => 'menu_order ID',
'id' => $post->ID,
'itemtag' => 'div',
'icontag' => 'div',
'captiontag' => 'div',
'columns' => 3,
'size' => 'thumbnail',
'exclude' => ''
), $attr ) );
// Get attributes from shortcode
extract( shortcode_atts( array(
'order' => 'ASC',
'orderby' => 'menu_order ID',
'id' => $post->ID,
'itemtag' => 'div',
'icontag' => 'div',
'captiontag' => 'div',
'columns' => 3,
'size' => 'thumbnail',
'exclude' => ''
), $attr ) );
// Initialize
$id = intval( $id );
$attachments = array();
if ( $order == 'RAND' ) $orderby = 'none';
// Initialize
$id = intval( $id );
$attachments = array();
if ( $order == 'RAND' ) $orderby = 'none';
if ( ! empty( $include ) ) {
if ( ! empty( $include ) ) {
// Include attribute is present
$include = preg_replace( '/[^0-9,]+/', '', $include );
$_attachments = get_posts( array( 'include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) );
// Include attribute is present
$include = preg_replace( '/[^0-9,]+/', '', $include );
$_attachments = get_posts( array( 'include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) );
// Setup attachments array
foreach ( $_attachments as $key => $val ) {
$attachments[ $val->ID ] = $_attachments[ $key ];
}
// Setup attachments array
foreach ( $_attachments as $key => $val ) {
$attachments[ $val->ID ] = $_attachments[ $key ];
}
} else if ( ! empty( $exclude ) ) {
} else if ( ! empty( $exclude ) ) {
// Exclude attribute is present
$exclude = preg_replace( '/[^0-9,]+/', '', $exclude );
// Exclude attribute is present
$exclude = preg_replace( '/[^0-9,]+/', '', $exclude );
// Setup attachments array
$attachments = get_children( array( 'post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) );
} else {
// Setup attachments array
$attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) );
}
// Setup attachments array
$attachments = get_children( array( 'post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) );
} else {
// Setup attachments array
$attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) );
}
if ( empty( $attachments ) ) return '';
if ( empty( $attachments ) ) return '';
// Filter gallery differently for feeds
if ( is_feed() ) {
$output = "\n";
foreach ( $attachments as $att_id => $attachment ) $output .= wp_get_attachment_link( $att_id, $size, true ) . "\n";
return $output;
}
// Filter gallery differently for feeds
if ( is_feed() ) {
$output = "\n";
foreach ( $attachments as $att_id => $attachment ) $output .= wp_get_attachment_link( $att_id, $size, true ) . "\n";
return $output;
}
// Filter tags and attributes
$itemtag = tag_escape( $itemtag );
$captiontag = tag_escape( $captiontag );
$columns = intval( $columns );
$itemwidth = $columns > 0 ? floor( 12 / $columns ) : 100;
$float = is_rtl() ? 'right' : 'left';
$selector = "gallery-{$instance}";
// Filter tags and attributes
$itemtag = tag_escape( $itemtag );
$captiontag = tag_escape( $captiontag );
$columns = intval( $columns );
$itemwidth = $columns > 0 ? floor( 12 / $columns ) : 100;
$float = is_rtl() ? 'right' : 'left';
$selector = "gallery-{$instance}";
// Filter gallery CSS
$output = apply_filters( 'gallery_style', "
$output = apply_filters( 'gallery_style', "
<div id='$selector' class='gallery galleryid-{$id} row'>"
);
<div class='gallery galleryid-{$id} row' id='$selector'>"
);
// Iterate through the attachments in this gallery instance
$i = 0;
foreach ( $attachments as $id => $attachment ) {
// Iterate through the attachments in this gallery instance
$i = 0;
foreach ( $attachments as $id => $attachment ) {
// Attachment link
$link = isset( $attr['link'] ) && 'file' == $attr['link'] ? wp_get_attachment_link( $id, $size, false, false ) : wp_get_attachment_link( $id, $size, true, false );
// Attachment link
$link = isset( $attr['link'] ) && 'file' == $attr['link'] ? wp_get_attachment_link( $id, $size, false, false ) : wp_get_attachment_link( $id, $size, true, false );
// Start itemtag
$output .= "<{$itemtag} class='gallery-item col-md-{$itemwidth}'>";
// Start itemtag
$output .= "<{$itemtag} class='gallery-item col-md-{$itemwidth}'>";
// icontag
$output .= "
<{$icontag} class='gallery-icon'>
$link
</{$icontag}>";
// icontag
$output .= "
<{$icontag} class='gallery-icon'>
$link
</{$icontag}>";
if ( $captiontag && trim( $attachment->post_excerpt ) ) {
if ( $captiontag && trim( $attachment->post_excerpt ) ) {
// captiontag
$output .= "
<{$captiontag} class='gallery-caption'>
" . wptexturize($attachment->post_excerpt) . "
</{$captiontag}>";
// captiontag
$output .= "
<{$captiontag} class='gallery-caption'>
" . wptexturize($attachment->post_excerpt) . "
</{$captiontag}>";
}
}
// End itemtag
$output .= "</{$itemtag}>";
// End itemtag
$output .= "</{$itemtag}>";
// Line breaks by columns set
if($columns > 0 && ++$i % $columns == 0) $output .= '<br style="clear: both">';
// Line breaks by columns set
if($columns > 0 && ++$i % $columns == 0) $output .= '<br style="clear: both">';
}
}
// End gallery output
$output .= "
<br style='clear: both;'>
</div>\n";
// End gallery output
$output .= "
<br style='clear: both;'>
</div>\n";
return $output;
return $output;
}

View File

@ -1,7 +1,7 @@
<?php
/**
*
* Adapted from Edward McIntyre's wp_bootstrap_navwalker class.
* Adapted from Edward McIntyre's wp_bootstrap_navwalker class.
* Removed support for glyphicon and added support for Font Awesome
*
*/
@ -18,126 +18,126 @@
//exit if accessed directly
if(!defined('ABSPATH')) exit;
class wp_bootstrap_navwalker extends Walker_Nav_Menu {
/**
* @see Walker::start_lvl()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of page. Used for padding.
*/
public function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n";
}
/**
* @see Walker::start_el()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param int $current_page Menu item ID.
* @param object $args
*/
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
/**
* Dividers, Headers or Disabled
* =============================
* Determine whether the item is a Divider, Header, Disabled or regular
* menu item. To prevent errors we use the strcasecmp() function to so a
* comparison that is not case sensitive. The strcasecmp() function returns
* a 0 if the strings are equal.
*/
if ( strcasecmp( $item->attr_title, 'divider' ) == 0 && $depth === 1 ) {
$output .= $indent . '<li role="presentation" class="divider">';
} else if ( strcasecmp( $item->title, 'divider') == 0 && $depth === 1 ) {
$output .= $indent . '<li role="presentation" class="divider">';
} else if ( strcasecmp( $item->attr_title, 'dropdown-header') == 0 && $depth === 1 ) {
$output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title );
} else if ( strcasecmp($item->attr_title, 'disabled' ) == 0 ) {
$output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>';
} else {
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'nav-item menu-item-' . $item->ID;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
/*
if ( $args->has_children )
$class_names .= ' dropdown';
*/
if($args->has_children && $depth === 0) { $class_names .= ' dropdown'; } elseif($args->has_children && $depth > 0) { $class_names .= ' dropdown-submenu'; }
if ( in_array( 'current-menu-item', $classes ) )
$class_names .= ' active';
// remove Font Awesome icon from classes array and save the icon
// we will add the icon back in via a <span> below so it aligns with
// the menu item
if ( in_array('fa', $classes)) {
$key = array_search('fa', $classes);
$icon = $classes[$key + 1];
$class_names = str_replace($classes[$key+1], '', $class_names);
$class_names = str_replace($classes[$key], '', $class_names);
}
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '<li' . $id . $value . $class_names .'>';
$atts = array();
$atts['title'] = ! empty( $item->title ) ? $item->title : '';
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
// If item has_children add atts to a.
/**
* @see Walker::start_lvl()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of page. Used for padding.
*/
public function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\" dropdown-menu\" role=\"menu\">\n";
}
/**
* @see Walker::start_el()
* @since 3.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param int $current_page Menu item ID.
* @param object $args
*/
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
/**
* Dividers, Headers or Disabled
* =============================
* Determine whether the item is a Divider, Header, Disabled or regular
* menu item. To prevent errors we use the strcasecmp() function to so a
* comparison that is not case sensitive. The strcasecmp() function returns
* a 0 if the strings are equal.
*/
if ( strcasecmp( $item->attr_title, 'divider' ) == 0 && $depth === 1 ) {
$output .= $indent . '<li class="divider" role="presentation">';
} else if ( strcasecmp( $item->title, 'divider') == 0 && $depth === 1 ) {
$output .= $indent . '<li class="divider" role="presentation">';
} else if ( strcasecmp( $item->attr_title, 'dropdown-header') == 0 && $depth === 1 ) {
$output .= $indent . '<li class="dropdown-header" role="presentation">' . esc_attr( $item->title );
} else if ( strcasecmp($item->attr_title, 'disabled' ) == 0 ) {
$output .= $indent . '<li class="disabled" role="presentation"><a href="#">' . esc_attr( $item->title ) . '</a>';
} else {
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'nav-item menu-item-' . $item->ID;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
/*
if ( $args->has_children )
$class_names .= ' dropdown';
*/
if($args->has_children && $depth === 0) { $class_names .= ' dropdown'; } elseif($args->has_children && $depth > 0) { $class_names .= ' dropdown-submenu'; }
if ( in_array( 'current-menu-item', $classes ) )
$class_names .= ' active';
// remove Font Awesome icon from classes array and save the icon
// we will add the icon back in via a <span> below so it aligns with
// the menu item
if ( in_array('fa', $classes)) {
$key = array_search('fa', $classes);
$icon = $classes[$key + 1];
$class_names = str_replace($classes[$key+1], '', $class_names);
$class_names = str_replace($classes[$key], '', $class_names);
}
if ( $args->has_children && $depth === 0 ) {
$atts['href'] = '#';
$atts['data-toggle'] = 'dropdown';
$atts['class'] = 'nav-link dropdown-toggle';
} else {
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
$atts['class'] = 'nav-link';
}
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
$attributes = '';
foreach ( $atts as $attr => $value ) {
if ( ! empty( $value ) ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$item_output = $args->before;
// Font Awesome icons
if ( ! empty( $icon ) )
$item_output .= '<a'. $attributes .'><span class="fa ' . esc_attr( $icon ) . '"></span>&nbsp;';
else
$item_output .= '<a'. $attributes .'>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
/**
* Traverse elements to create list from elements.
*
* Display one element if the element doesn't have any children otherwise,
* display the element and its children. Will only traverse up to the max
* depth and no ignore elements under that depth.
*
* This method shouldn't be called directly, use the walk() method instead.
*
* @see Walker::start_el()
* @since 2.5.0
*
* @param object $element Data object
* @param array $children_elements List of elements to continue traversing.
* @param int $max_depth Max depth to traverse.
* @param int $depth Depth of current element.
* @param array $args
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '<li' . $id . $value . $class_names .'>';
$atts = array();
$atts['title'] = ! empty( $item->title ) ? $item->title : '';
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
// If item has_children add atts to a.
if ( $args->has_children && $depth === 0 ) {
$atts['href'] = '#';
$atts['data-toggle'] = 'dropdown';
$atts['class'] = 'nav-link dropdown-toggle';
} else {
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
$atts['class'] = 'nav-link';
}
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args );
$attributes = '';
foreach ( $atts as $attr => $value ) {
if ( ! empty( $value ) ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$item_output = $args->before;
// Font Awesome icons
if ( ! empty( $icon ) )
$item_output .= '<a'. $attributes .'><span class="fa ' . esc_attr( $icon ) . '"></span>&nbsp;';
else
$item_output .= '<a'. $attributes .'>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
/**
* Traverse elements to create list from elements.
*
* Display one element if the element doesn't have any children otherwise,
* display the element and its children. Will only traverse up to the max
* depth and no ignore elements under that depth.
*
* This method shouldn't be called directly, use the walk() method instead.
*
* @see Walker::start_el()
* @since 2.5.0
*
* @param object $element Data object
* @param array $children_elements List of elements to continue traversing.
* @param int $max_depth Max depth to traverse.
* @param int $depth Depth of current element.
* @param array $args
* @param string $output Passed by reference. Used to append additional content.
* @return null Null on failure with no changes to parameters.
*/
public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
if ( ! $element )
return;
$id_field = $this->db_fields['id'];
@ -146,41 +146,40 @@ class wp_bootstrap_navwalker extends Walker_Nav_Menu {
$args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] );
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
}
/**
* Menu Fallback
* =============
* If this function is assigned to the wp_nav_menu's fallback_cb variable
* and a manu has not been assigned to the theme location in the WordPress
* menu manager the function with display nothing to a non-logged in user,
* and will add a link to the WordPress menu manager if logged in as an admin.
*
* @param array $args passed from the wp_nav_menu function.
*
*/
public static function fallback( $args ) {
if ( current_user_can( 'manage_options' ) ) {
extract( $args );
$fb_output = null;
if ( $container ) {
$fb_output = '<' . $container;
if ( $container_id )
$fb_output .= ' id="' . $container_id . '"';
if ( $container_class )
$fb_output .= ' class="' . $container_class . '"';
$fb_output .= '>';
}
$fb_output .= '<ul';
if ( $menu_id )
$fb_output .= ' id="' . $menu_id . '"';
if ( $menu_class )
$fb_output .= ' class="' . $menu_class . '"';
$fb_output .= '>';
$fb_output .= '<li><a href="' . admin_url( 'nav-menus.php' ) . '">Add a menu</a></li>';
$fb_output .= '</ul>';
if ( $container )
$fb_output .= '</' . $container . '>';
echo $fb_output;
}
}
/**
* Menu Fallback
* =============
* If this function is assigned to the wp_nav_menu's fallback_cb variable
* and a manu has not been assigned to the theme location in the WordPress
* menu manager the function with display nothing to a non-logged in user,
* and will add a link to the WordPress menu manager if logged in as an admin.
*
* @param array $args passed from the wp_nav_menu function.
*
*/
public static function fallback( $args ) {
if ( current_user_can( 'manage_options' ) ) {
extract( $args );
$fb_output = null;
if ( $container ) {
$fb_output = '<' . $container;
if ( $container_class )
$fb_output .= ' class="' . $container_class . '"';
if ( $container_id )
$fb_output .= ' id="' . $container_id . '"';
$fb_output .= '>';
}
$fb_output .= '<ul';
if ( $menu_class )
$fb_output .= ' class="' . $menu_class . '"';
if ( $menu_id )
$fb_output .= ' id="' . $menu_id . '"';
$fb_output .= '>';
$fb_output .= '<li><a href="' . admin_url( 'nav-menus.php' ) . '">Add a menu</a></li>';
$fb_output .= '</ul>';
if ( $container )
$fb_output .= '</' . $container . '>';
echo $fb_output;
}
}
}

View File

@ -23,7 +23,7 @@
function bootstrap3_comment_form( $args ) {
$args['comment_field'] = '<div class="form-group comment-form-comment">
<label for="comment">' . _x( 'Comment', 'noun', 'understrap' ) . ( ' <span class="required">*</span>' ) . '</label>
<textarea class="form-control" id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
<textarea class="form-control" id="comment" name="comment" aria-required="true" cols="45" rows="8"></textarea>
</div>';
$args['class_submit'] = 'btn btn-secondary'; // since WP 4.1
return $args;

View File

@ -24,13 +24,13 @@
<div class="wrapper" id="wrapper-index">
<div id="content" class="container">
<div class="container" id="content">
<div class="row">
<div id="primary" class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area">
<div class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area" id="primary">
<main id="main" class="site-main" role="main">
<main class="site-main" id="main" role="main">
<?php if ( have_posts() ) : ?>

View File

@ -9,7 +9,7 @@
?>
<article id="post-0" class="post no-results not-found">
<article class="post no-results not-found" id="post-0">
<header class="page-header">

View File

@ -6,7 +6,7 @@
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<header class="entry-header">

View File

@ -4,7 +4,7 @@
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<header class="entry-header">

View File

@ -4,7 +4,7 @@
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<header class="entry-header">
@ -18,7 +18,7 @@
</header><!-- .entry-header -->
<?php echo get_the_post_thumbnail( $post->ID, 'large' ); ?>
<?php echo get_the_post_thumbnail( $post->ID, 'large' ); ?>
<div class="entry-content">

View File

@ -8,7 +8,7 @@
<?php global $post ?>
<article id="<?php echo strtolower( $post->post_title ); ?>" <?php post_class(); ?>>
<article <?php post_class(); ?> id="<?php echo strtolower( $post->post_title ); ?>">
<header class="entry-header">

View File

@ -4,7 +4,7 @@
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<header class="entry-header">

View File

@ -12,11 +12,11 @@
<div class="wrapper" id="full-width-page-wrapper">
<div id="content" class="container">
<div class="container" id="content">
<div id="primary" class="col-md-12 content-area">
<div class="col-md-12 content-area" id="primary">
<main id="main" class="site-main" role="main">
<main class="site-main" id="main" role="main">
<?php while ( have_posts() ) : the_post(); ?>

View File

@ -28,11 +28,11 @@
<div class="wrapper" id="full-width-page-wrapper">
<div id="content" class="container">
<div class="container" id="content">
<div id="primary" class="col-md-12 content-area">
<div class="col-md-12 content-area" id="primary">
<main id="main" class="site-main" role="main">
<main class="site-main" id="main" role="main">
<?php if ( have_posts() ): while ( $qry->have_posts() ): $qry->the_post() ?>
<div class="page">

View File

@ -15,13 +15,13 @@
<div class="wrapper" id="page-wrapper">
<div id="content" class="container">
<div class="container" id="content">
<div class="row">
<div id="primary" class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area">
<div class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area" id="primary">
<main id="main" class="site-main" role="main">
<main class="site-main" id="main" role="main">
<?php while ( have_posts() ) : the_post(); ?>

View File

@ -13,9 +13,9 @@
<div class="row">
<section id="primary" class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area">
<section class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area" id="primary">
<main id="main" class="site-main" role="main">
<main class="site-main" id="main" role="main">
<?php if ( have_posts() ) : ?>

View File

@ -7,11 +7,11 @@
?>
<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" role="search">
<label for="s" class="assistive-text"><?php _e( 'Search', 'understrap' ); ?></label>
<label class="assistive-text" for="s"><?php _e( 'Search', 'understrap' ); ?></label>
<div class="input-group">
<input type="text" class="field form-control" name="s" id="s" placeholder="<?php esc_attr_e( 'Search &hellip;', 'understrap' ); ?>">
<input class="field form-control" id="s" name="s" type="text" placeholder="<?php esc_attr_e( 'Search &hellip;', 'understrap' ); ?>">
<span class="input-group-btn">
<input type="submit" class="submit btn btn-primary" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'understrap' ); ?>">
<input class="submit btn btn-primary" id="searchsubmit" name="submit" type="submit" value="<?php esc_attr_e( 'Search', 'understrap' ); ?>">
</span>
</div>
</form>

View File

@ -10,7 +10,7 @@ if ( ! is_active_sidebar( 'sidebar-1' ) ) {
}
?>
<div id="secondary" class="col-md-4 widget-area" role="complementary">
<div class="col-md-4 widget-area" id="secondary" role="complementary">
<?php dynamic_sidebar( 'sidebar-1' ); ?>

View File

@ -9,13 +9,13 @@
?>
<div class="wrapper" id="single-wrapper">
<div id="content" class="container">
<div class="container" id="content">
<div class="row">
<div id="primary" class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area">
<div class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area" id="primary">
<main id="main" class="site-main" role="main">
<main class="site-main" id="main" role="main">
<?php while ( have_posts() ) : the_post(); ?>

View File

@ -17,9 +17,9 @@
<div class="container">
<div id="primary" class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area">
<div class="<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>col-md-8<?php else : ?>col-md-12<?php endif; ?> content-area" id="primary">
<main id="main" class="site-main" role="main">
<main class="site-main" id="main" role="main">
<!-- The WooCommerce loop -->