/** * Modifies product name field placeholder * * @param str $message * @return str */ function al_enter_title_here($message) { $screen = get_current_screen(); if (ic_string_contains($screen->id, 'al_product')) { if (is_plural_form_active()) { $names = get_catalog_names(); $message = sprintf(__('Enter %s name here', 'ecommerce-product-catalog'), ic_strtolower($names['singular'])); } else { $message = __('Enter item name here', 'ecommerce-product-catalog'); } } return $message; }
/** * Adds product post type navigation menu current class * * @global type $post * @param string $classes * @param type $item * @return string */ function product_listing_current_nav_class($classes, $item) { global $post; if (isset($post->ID) && is_ic_product_listing()) { if ($item->object_id == get_product_listing_id()) { $current_post_type = get_post_type_object(get_post_type($post->ID)); $current_post_type_slug = $current_post_type->rewrite['slug']; $current_post_type_slug = !empty($current_post_type_slug) ? '/' . $current_post_type_slug . '/' : $current_post_type_slug; $menu_slug = ic_strtolower(trim($item->url)); if (strpos($menu_slug, $current_post_type_slug) !== false) { $classes[] = 'current-menu-item'; } } else { if (($key = array_search('current-menu-item', $classes)) !== false) { unset($classes[$key]); } if (($key = array_search('current_page_parent', $classes)) !== false) { unset($classes[$key]); } } } else { if (isset($post->ID) && (is_ic_product_page() || is_ic_taxonomy_page())) { if (strpos($item->object, 'al_product-cat') === false && $item->object != 'custom') { if (($key = array_search('current-menu-item', $classes)) !== false) { unset($classes[$key]); } if (($key = array_search('current_page_parent', $classes)) !== false) { unset($classes[$key]); } } } } return $classes; }
function set_product_messages($messages) { global $post, $post_ID; $quasi_post_type = get_quasi_post_type(); $post_type = get_post_type($post_ID); if ($quasi_post_type == 'al_product') { $obj = get_post_type_object($post_type); $singular = $obj->labels->singular_name; $messages[$post_type] = array(0 => '', 1 => sprintf(__('%s updated. <a href="%s">View ' . ic_strtolower($singular) . '</a>'), $singular, esc_url(get_permalink($post_ID))), 2 => __('Custom field updated.'), 3 => __('Custom field deleted.'), 4 => sprintf(__('%s updated.', 'ecommerce-product-catalog'), $singular), 5 => isset($_GET['revision']) ? sprintf(__($singular . ' restored to revision from %s'), $singular, wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__($singular . ' published. <a href="%s">View ' . ic_strtolower($singular) . '</a>'), esc_url(get_permalink($post_ID)), $singular), 7 => __('Page saved.'), 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>'), $singular, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), strtolower($singular)), 9 => sprintf(__('%3$s scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview ' . ic_strtolower($singular) . '</a>'), date_i18n(__('M j, Y @ G:i'), strtotime($post->post_date)), esc_url(get_permalink($post_ID)), $singular), 10 => sprintf(__('%s draft updated. <a target="_blank" href="%s">Preview ' . ic_strtolower($singular) . '</a>'), $singular, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))))); } return $messages; }