Dashboard'; $links[] = $settings_link; return $links; } function hide_submenu_entries($submenu_file) { global $plugin_page; $hidden_submenus = array( AFFILILABS_SLUG . "-product-edit" => true, AFFILILABS_SLUG . "-marketplace-edit" => true, AFFILILABS_SLUG . "-criteria-edit" => true, AFFILILABS_SLUG . "-list-edit" => true, AFFILILABS_SLUG . "-template-editor" => true, AFFILILABS_SLUG . "-product-category-edit" => true, ); // highlight another submenu if ( $plugin_page && isset( $hidden_submenus[ $plugin_page ] ) ) { switch ($plugin_page) { case AFFILILABS_SLUG . "-product-edit": $submenu_file = AFFILILABS_SLUG . "-products"; break; case AFFILILABS_SLUG . "-marketplace-edit": $submenu_file = AFFILILABS_SLUG . "-marketplaces"; break; // break; case AFFILILABS_SLUG . "-criteria-edit": $submenu_file = AFFILILABS_SLUG . "-criteria"; break; case AFFILILABS_SLUG . "-list-edit": $submenu_file = AFFILILABS_SLUG . "-lists"; break; case AFFILILABS_SLUG . "-template-editor": $submenu_file = AFFILILABS_SLUG . "-templates"; break; case AFFILILABS_SLUG . "-product-category-edit": $submenu_file = AFFILILABS_SLUG . "-product-categories"; break; } } foreach ( $hidden_submenus as $submenu => $_ ) { remove_submenu_page(AFFILILABS_SLUG , $submenu ); } return $submenu_file; } function highlight_parent_menu($parent_file) { global $current_screen, $pagenow, $submenu_file; $is_current_page_product_categories = ( $pagenow == 'edit-tags.php' && $current_screen->post_type == AFFILILABS_CPT_PRODUCT && $current_screen->taxonomy == AFFILILABS_TAXONOMY_PRODUCT_CATEGORY ); if ($is_current_page_product_categories) { $parent_file = AFFILILABS_CLASSIC_SLUG; $submenu_file = "edit-tags.php?taxonomy=" . AFFILILABS_TAXONOMY_PRODUCT_CATEGORY . "&post_type=" . AFFILILABS_CPT_PRODUCT; } return $parent_file; } function enqueue_admin_scripts() { wp_enqueue_style('affililabs-common', AFFILILABS_COMMON_BASE_CSS_URL, array(), AFFILILABS_VERSION); } function enqueue_frontend_scripts() { if ( is_singular( AFFILILABS_CPT_PRODUCT ) ) { wp_enqueue_style( 'affililabs-single-product', AFFILILABS_SINGLE_PRODUCT_TEMPLATE_CSS_URL, array(), AFFILILABS_VERSION ); // Logic to add inline styles/scripts from custom template affl_import(AFFILILABS_SERVICE_OPTIMIZEPRESS_FILE); if (class_exists('Affililabs_Optimizepress_Integration')) { $integration = new Affililabs_Optimizepress_Integration(); $op3_present = $integration->is_op3_present(); $template_enabled = AFFLSettingsService::get_enable_custom_template(); if (!$op3_present && $template_enabled) { $product_id = get_the_ID(); $template_id = get_post_meta($product_id, AFFILILABS_META_KEY_APPLIED_PRODUCT_TEMPLATE_ID, true); } } } wp_enqueue_style( 'affl-product-fields', AFFILILABS_SHORTCODE_PRODUCT_FIELDS_CSS_URL, array(), AFFILILABS_VERSION ); } function render_dashboard() { affl_import(AFFILILABS_DASHBOARD_FILE); } function render_marketplaces() { affl_import(AFFILILABS_MARKETPLACES_FILE); } function render_marketplace_edit() { affl_import(AFFILILABS_MARKETPLACE_EDIT_FILE); } function render_product_edit() { affl_import(AFFILILABS_PRODUCTS_EDIT_FILE); } function render_products() { affl_import(AFFILILABS_PRODUCTS_FILE); } function render_product_categories() { affl_import(AFFILILABS_PRODUCT_CATEGORIES_FILE); } function render_product_category_edit() { affl_import(AFFILILABS_PRODUCT_CATEGORY_EDIT_FILE); } function render_criteria() { affl_import(AFFILILABS_CRITERIA_FILE); } function render_criteria_edit() { affl_import(AFFILILABS_CRITERIA_EDIT_FILE); } function render_lists() { affl_import(AFFILILABS_LISTS_FILE); } function render_list_edit() { affl_import(AFFILILABS_LIST_EDIT_FILE); } function render_templates() { affl_import(AFFILILABS_TEMPLATES_FILE); } function render_template_editor() { affl_import(AFFILILABS_TEMPLATE_EDITOR_FILE); } function render_about_us() { affl_import(AFFILILABS_ABOUT_US_FILE); } function render_classic_links() { affl_import(AFFILILABS_CLASSIC_LINKS_FILE); } function render_settings() { affl_import(AFFILILABS_SETTINGS_FILE); } function render_logs_page() { affl_import(AFFILILABS_LOG_PAGE_FILE); } public function inject_single_product_template_content( $content ) { if ( is_singular( AFFILILABS_CPT_PRODUCT ) && in_the_loop() && is_main_query() ) { $integration = new Affililabs_Optimizepress_Integration(); $op3_present = $integration->is_op3_present(); $template_enabled = AFFLSettingsService::get_enable_custom_template(); if (!$op3_present && $template_enabled) { $product_id = get_the_ID(); $template_id = get_post_meta($product_id, AFFILILABS_META_KEY_APPLIED_PRODUCT_TEMPLATE_ID, true); if ( $template_id ) { $template = get_post($template_id); if ($template && $template->post_type === AFFILILABS_CPT_TEMPLATE) { $template_modules = get_post_meta($template_id, AFFILILABS_META_KEY_TEMPLATE_DATA, true); $output_html = ''; if (!empty($template_modules) && is_array($template_modules)) { foreach ($template_modules as $module) { $shortcode_output = do_shortcode('[affl_' . $module . ' id="' . $product_id . '"]'); if (!empty(trim($shortcode_output))) { $class_name = 'affl_' . str_replace('_', '-', $module); // Injecting the shortcode output into a div with a class for styling // The actual HTML structure will depend on how each shortcode is designed to render $output_html .= '