';
/* translators: %1$s: link to menus, %2$s: link to customize. */
printf(
__( 'Please assign a menu to the primary menu location under %1$s or %2$s the design.', 'foundationpress' ),
/* translators: %s: menu url */
sprintf(
__( '
Menus', 'foundationpress' ),
get_admin_url( get_current_blog_id(), 'nav-menus.php' )
),
/* translators: %s: customize url */
sprintf(
__( '
Customize', 'foundationpress' ),
get_admin_url( get_current_blog_id(), 'customize.php' )
)
);
echo '
';
}
endif;
// Add Foundation 'is-active' class for the current menu item.
if ( ! function_exists( 'foundationpress_active_nav_class' ) ) :
function foundationpress_active_nav_class( $classes, $item ) {
if ( $item->current == 1 || $item->current_item_ancestor == true ) {
$classes[] = 'is-active';
}
return $classes;
}
add_filter( 'nav_menu_css_class', 'foundationpress_active_nav_class', 10, 2 );
endif;
/**
* Use the is-active class of ZURB Foundation on wp_list_pages output.
* From required+ Foundation http://themes.required.ch.
*/
if ( ! function_exists( 'foundationpress_active_list_pages_class' ) ) :
function foundationpress_active_list_pages_class( $input ) {
$pattern = '/current_page_item/';
$replace = 'current_page_item is-active';
$output = preg_replace( $pattern, $replace, $input );
return $output;
}
add_filter( 'wp_list_pages', 'foundationpress_active_list_pages_class', 10, 2 );
endif;
/**
* Get mobile menu ID
*/
if ( ! function_exists( 'foundationpress_mobile_menu_id' ) ) :
function foundationpress_mobile_menu_id() {
if ( get_theme_mod( 'wpt_mobile_menu_layout' ) === 'offcanvas' ) {
echo 'off-canvas-menu';
} else {
echo 'mobile-menu';
}
}
endif;
/**
* Get title bar responsive toggle attribute
*/
if ( ! function_exists( 'foundationpress_title_bar_responsive_toggle' ) ) :
function foundationpress_title_bar_responsive_toggle() {
if ( ! get_theme_mod( 'wpt_mobile_menu_layout' ) || get_theme_mod( 'wpt_mobile_menu_layout' ) === 'topbar' ) {
echo 'data-responsive-toggle="mobile-menu"';
}
}
endif;
/**
* Custom markup for Wordpress gallery
*/
if ( ! function_exists( 'foundationpress_gallery' ) ) :
function foundationpress_gallery($attr) {
$post = get_post();
static $instance = 0;
$instance++;
if ( ! empty( $attr['ids'] ) ) {
// 'ids' is explicitly ordered, unless you specify otherwise.
if ( empty( $attr['orderby'] ) )
$attr['orderby'] = 'post__in';
$attr['include'] = $attr['ids'];
}
// Allow plugins/themes to override the default gallery template.
$output = apply_filters('post_gallery', '', $attr, $instance);
if ( $output != '' )
return $output;
// Let's make sure it looks like a valid orderby statement
if ( isset( $attr['orderby'] ) ) {
$attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
if ( !$attr['orderby'] )
unset( $attr['orderby'] );
}
$atts = shortcode_atts(array(
'order' => 'ASC',
'orderby' => 'menu_order ID',
'id' => $post ? $post->ID : 0,
'itemtag' => 'figure',
'icontag' => 'div',
'captiontag' => 'figcaption',
'columns-small' => 2, // set default columns for small screen
'columns-medium'=> 4, // set default columns for medium screen
'columns' => 4, // set default columns for large screen (3 = wordpress default)
'size' => 'medium',
'include' => '',
'exclude' => ''
), $attr, 'gallery');
$id = intval($atts['id']);
if ( !empty($atts['include']) ) {
$_attachments = get_posts( array('include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']) );
$attachments = array();
foreach ( $_attachments as $key => $val ) {
$attachments[$val->ID] = $_attachments[$key];
}
} elseif ( !empty($atts['exclude']) ) {
$attachments = get_children( array('post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']) );
} else {
$attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']) );
}
if ( empty($attachments) )
return '';
if ( is_feed() ) {
$output = "\n";
foreach ( $attachments as $att_id => $attachment )
$output .= wp_get_attachment_link($att_id, $atts['size'], true) . "\n";
return $output;
}
$item_tag = tag_escape($atts['itemtag']);
$caption_tag = tag_escape($atts['captiontag']);
$icon_tag = tag_escape($atts['icontag']);
$valid_tags = wp_kses_allowed_html( 'post' );
if ( ! isset( $valid_tags[ $item_tag ] ) )
$item_tag = 'figure';
if ( ! isset( $valid_tags[ $caption_tag ] ) )
$caption_tag = 'figcaption';
if ( ! isset( $valid_tags[ $icon_tag ] ) )
$icon_tag = 'div';
$columns = intval($atts['columns']);
$columns_small = intval($atts['columns-small']);
$columns_medium = intval($atts['columns-medium']);
$selector = "gallery-{$instance}";
$size_class = sanitize_html_class( $atts['size'] );
// Edit this line to modify the default number of grid columns for the small and medium sizes. The large size is passed in the WordPress gallery settings.
$output = "