public function frontend_menu() { if (!is_user_logged_in() || !current_user_can('manage_options')) { return; } if (isset($_GET['iframe']) && $_GET['iframe'] == true) { return; } global $TF, $TF_Layout; $menus_list = array('edit_template' => array('label' => __('Edit Template', 'themify-flow'), 'href' => esc_url(add_query_arg('tf', 1, get_permalink(get_the_ID())))), 'import_export_template' => array('label' => __('Import/Export', 'themify-flow'), 'href' => '#'), 'import_template' => array('label' => __('Import', 'themify-flow'), 'href' => '#', 'parent' => 'import_export_template', 'meta' => array('class' => 'tf_import_template')), 'export_template' => array('label' => __('Export', 'themify-flow'), 'href' => wp_nonce_url(admin_url('post.php?post=' . get_the_ID() . '&action=export_tf_template'), 'export_tf_nonce'), 'parent' => 'import_export_template', 'meta' => array('class' => 'tf_template_admin_menu_export')), 'template_option' => array('label' => __('Template Options', 'themify-flow'), 'href' => '#', 'meta' => array('class' => 'tf_template_admin_menu_options'))); $menus = array(); if (is_singular('tf_template') && !TF_Model::is_tf_editor_active()) { $menus['edit_template'] = $menus_list['edit_template']; } else { if (is_singular('tf_template') && TF_Model::is_tf_editor_active()) { $menus['import_export_template'] = $menus_list['import_export_template']; $menus['import_template'] = $menus_list['import_template']; $menus['export_template'] = $menus_list['export_template']; $menus['template_option'] = $menus_list['template_option']; } else { if (is_singular('tf_template_part') && !TF_Model::is_tf_editor_active()) { $menus['edit_template_part'] = array('label' => __('Edit Template Part', 'themify-flow'), 'href' => esc_url(add_query_arg('tf', 1, get_permalink(get_the_ID())))); } else { if (is_singular('tf_template_part') && TF_Model::is_tf_editor_active()) { $menus['import_export_template_part'] = array('label' => __('Import/Export', 'themify-flow'), 'href' => '#'); $menus['import_template_part'] = array('label' => __('Import', 'themify-flow'), 'href' => '#', 'parent' => 'import_export_template_part', 'meta' => array('class' => 'tf_import_template_part')); $menus['export_template_part'] = array('label' => __('Export', 'themify-flow'), 'href' => wp_nonce_url(admin_url('post.php?post=' . get_the_ID() . '&action=export_tf_template_part'), 'export_tf_nonce'), 'parent' => 'import_export_template_part'); } else { // In use template if (0 !== $TF_Layout->layout_id) { $menus['in_use_template'] = array('label' => __('Edit In-use Template', 'themify-flow'), 'href' => esc_url(add_query_arg(array('tf' => 1, 'tf_source_uri' => TF_Model::get_current_browser_url()), get_permalink($TF_Layout->layout_id)))); } // Template $menus['template_list'] = array('label' => __('Templates', 'themify-flow'), 'href' => '#'); $menus['template_list_add_new'] = array('label' => __('Add New', 'themify-flow'), 'href' => admin_url('edit.php?post_type=tf_template#tf_add_new'), 'parent' => 'template_list'); $menus['template_list_view'] = array('label' => __('View all Templates', 'themify-flow'), 'href' => admin_url('edit.php?post_type=tf_template'), 'parent' => 'template_list'); // Template Part $menus['template_part_list'] = array('label' => __('Template Parts', 'themify-flow'), 'href' => '#'); $menus['template_part_list_add_new'] = array('label' => __('Add New', 'themify-flow'), 'href' => admin_url('edit.php?post_type=tf_template_part#tf_add_new'), 'parent' => 'template_part_list'); $menus['template_part_list_view'] = array('label' => __('View all Template Parts', 'themify-flow'), 'href' => admin_url('edit.php?post_type=tf_template_part'), 'parent' => 'template_part_list'); if (TF_Model::is_tf_styling_active()) { $menus['global_styling'] = array('label' => __('Global Styling', 'themify-flow'), 'href' => '#', 'meta' => array('class' => 'tf_load_global_styling')); $menus['custom_css'] = array('label' => __('Custom CSS', 'themify-flow'), 'href' => '#', 'meta' => array('class' => 'tf_load_customcss')); } else { $menus['edit_global_styling'] = array('label' => __('Global Styling', 'themify-flow'), 'href' => esc_url(add_query_arg(array('tf' => 1, 'tf_global_styling' => 1)))); $menus['edit_custom_css'] = array('label' => __('Custom CSS', 'themify-flow'), 'href' => esc_url(add_query_arg(array('tf' => 1, 'tf_custom_css' => 1)))); } $menus['theme_settings'] = array('label' => __('Settings', 'themify-flow'), 'href' => admin_url('admin.php?page=tf-settings')); } } } } $menus = apply_filters('tf_frontend_menus', $menus); $frontend_menus = tf_parse_menu($menus); include_once sprintf('%s/includes/templates/template-frontend-menu.php', $TF->framework_path()); }