';
return apply_filters( 'ast_get_search', $search_html, $filter_html );
}
}
/**
* Get custom HTML added by user.
*/
if ( ! function_exists( 'ast_get_custom_html' ) ) {
/**
* Get custom HTML added by user.
*
* @since 1.0
* @param string $option_name Option name.
* @return String TEXT/HTML added by user in options panel.
*/
function ast_get_custom_html( $option_name = '' ) {
$custom_html = '';
$custom_html_content = ast_get_option( $option_name );
if ( ! empty( $custom_html_content ) ) {
$custom_html = '
' . do_shortcode( $custom_html_content ) . '
';
} elseif ( current_user_can( 'edit_theme_options' ) ) {
$custom_html = '' . __( 'Add Custom HTML', 'astra-theme' ) . '';
}
return $custom_html;
}
}
/**
* Astra Theme Nav Menu
*/
if ( ! function_exists( 'ast_nav_menu' ) ) {
/**
* Helper function for wp_nav_menu() checks if menu is set, if not set returns with message for capable users to set the menu.
*
* @since 1.0
* @param array $menu It will be either 'Menu location' (string) or Argument array of 'Menu'.
* @param array $fallback_menu Fallback menu if menu location is not set.
* @param boolean $echo Echo menu markup.
* @return mixed Echo or Return Markup for menu or message to set the menu.
*/
function ast_nav_menu( $menu = array(), $fallback_menu = array(), $echo = true ) {
/**
* Get menu / fallback menu markup
*/
if ( has_nav_menu( $menu['theme_location'] ) ) {
// Initially set echo to false and get nav markup.
$menu['echo'] = false;
$nav = wp_nav_menu( $menu );
/**
* Has fallback menu support?
*/
} elseif ( false == $fallback_menu ) {
$nav = 'Assign a menu to location ' . strtoupper( $menu['theme_location'] ) . '';
/**
* Set fallback menu support.
*/
} else {
// Initially set echo to false and get nav markup.
$fallback_menu['echo'] = false;
$nav = wp_page_menu( $fallback_menu );
}
/**
* Echo / return markup
*/
if ( $echo ) {
echo $nav;
} else {
return $nav;
}
}
}// End if().
/**
* Function to get Small Left/Right Footer
*/
if ( ! function_exists( 'ast_get_small_footer' ) ) {
/**
* Function to get Small Left/Right Footer
*
* @since 1.0
* @param string $section Sections of Small Footer.
* @return mixed Markup of sections.
*/
function ast_get_small_footer( $section = '' ) {
$small_footer_type = ast_get_option( $section );
$output = null;
switch ( $small_footer_type ) {
case 'menu':
$output = ast_get_small_footer_menu();
break;
case 'custom':
$output = ast_get_option( $section . '-credit' );
$output = str_replace( '[current_year]', date( 'Y' ), $output );
$output = str_replace( '[site_title]', '' . get_option( 'blogname' ) . '', $output );
$theme_author = apply_filters( 'ast_theme_author', array(
'theme_name' => __( 'Astra', 'astra-theme' ),
'theme_author_url' => 'https://www.brainstormforce.com/',
) );
$output = str_replace( '[theme_author]', '' . $theme_author['theme_name'] . '', $output );
break;
}
return $output;
}
}// End if().
/**
* Function to get Footer Menu
*/
if ( ! function_exists( 'ast_get_small_footer_menu' ) ) {
/**
* Function to get Footer Menu
*
* @since 1.0
* @return html
*/
function ast_get_small_footer_menu() {
ob_start(); ?>
*
* @since 1.0
*/
function ast_header_markup() {
?>
'primary',
'menu_id' => 'primary-menu',
'menu_class' => 'main-header-menu ast-flex ast-justify-content-flex-end' . $submenu_class,
'container_class' => 'main-navigation',
'echo' => false,
'container' => 'div',
'walker' => new Ast_Nav_Menu_Walker(),
);
// Fallback Menu if primary menu not set.
$fallback_menu_args = array(
'menu_class' => 'main-navigation',
'menu_id' => 'primary-menu',
'container' => 'div',
'before' => '
',
'after' => '
',
'echo' => false,
'walker' => new Ast_Walker_Page(),
// Below option is NOT a nav page menu option.
// Just used to apply filter to add custom menu items though filter.
'theme_location' => 'primary',
); ?>