'.__('Error loading posts.', 'themify').'
';
}
return apply_filters( 'themify_mega_posts_output', $mega_posts, $term_id, $taxonomy );
}
}
if( ! function_exists( 'themify_theme_mega_posts' ) ) {
/**
* Called with AJAX to return posts
* @since 1.0.0
*/
function themify_theme_mega_posts() {
$termid = isset( $_POST['termid'] ) ? absint( $_POST['termid'] ) : 0;
$taxonomy = isset( $_POST['tax'] ) ? sanitize_key( $_POST['tax'] ) : 'category';
die(themify_theme_mega_get_posts( $termid, $taxonomy ));
}
}
add_action('wp_ajax_themify_theme_mega_posts', 'themify_theme_mega_posts');
add_action('wp_ajax_nopriv_themify_theme_mega_posts', 'themify_theme_mega_posts');
/***************************************************
* Themify Theme Access Point
***************************************************/
if ( ! function_exists( 'themify_theme_main_menu' ) ) {
/**
* Sets custom menu selected in page custom panel as navigation, otherwise sets the default.
*
* @since 1.0.0
*/
function themify_theme_main_menu( $args = array() ) {
$args['echo'] = false;
$menu_type = 'main';
if( 'no' !== themify_get( 'setting-mega_menu',false,true ) ) {
$args['walker'] = new Themify_Mega_Menu_Walker;
$menu_type = 'mega';
}
echo apply_filters( 'themify_' . $menu_type . '_menu_html', themify_menu_nav( $args ), $args );
}
}
/**
* Check if mega menu is enabled for a menu item
*
* @param int $item_id
* @param string $type
*
* @return bool
* @since 1.0.0
*/
function themify_is_mega_menu_type( $item_id, $type = 'mega' ) {
if($type==='mega' || $type==='column' || $type==='dual'){
$key=$type==='mega'?'item':$type;
return get_post_meta( $item_id, '_themify_mega_menu_'.$key, true ) == '1';
}
}
function themify_is_menu_highlighted_link( $item_id ) {
return get_post_meta( $item_id, '_themify_highlight_link', true );
}
/**
* Add the option to enable mega menu to taxonomy menu types
*
* @since 1.0.0
*/
function themify_menu_mega_option( $item_id, $item, $depth, $args ) {
$dropdown_columns = (int) get_post_meta( $item_id, '_themify_dropdown_columns', true );
$is_mega = themify_is_mega_menu_type( $item_id, 'mega' );
$is_column = !$is_mega && themify_is_mega_menu_type( $item_id, 'column' );
$is_dropdown_column = !$is_column && ! empty( $dropdown_columns );
$column_layout = get_post_meta( $item_id, '_themify_mega_menu_columns_layout', true );
?>
';
foreach ( array(
'' => __( 'Auto', 'themify' ),
'4-8' => __( '1/3 - 2/3', 'themify' ),
'8-4' => __( '2/3 - 1/3', 'themify' ),
'6-3-3' => __( '2/4 - 1/4 - 1/4', 'themify' ),
'3-3-6' => __( '1/4 - 1/4 - 2/4', 'themify' ),
'3-6-3' => __( '1/4 - 2/4 - 1/4', 'themify' ),
'3-9' => __( '1/4 - 3/4', 'themify' ),
'9-3' => __( '3/4 - 1/4', 'themify' ),
) as $key => $label ) {
$selected = $column_layout === $key ? 'class="selected"' : '';
echo '
';
}
?>