function extra_the_project_details_box($post_id = 0, $is_the_sidebar = false) { $post_id = empty($post_id) ? get_the_ID() : $post_id; $project_details = extra_get_project_details($post_id); $defaults = array('title' => __('Project Details:', 'extra'), 'project_url_text' => __('View The Project', 'extra')); $project_details = et_parse_args($project_details, $defaults); $categories_list = get_the_term_list($post_id, EXTRA_PROJECT_CATEGORY_TAX, '<li>', '</li><li>', '</li>'); $skills_list = get_the_term_list($post_id, EXTRA_PROJECT_TAG_TAX, '<li>', '</li><li>', '</li>'); $description = !empty($project_details['description']) ? sprintf('<p>%s</p>', wp_kses_post($project_details['description'])) : ''; $project_details['title'] = !empty($project_details['title']) ? $project_details['title'] : $defaults['title']; $project_url = sprintf('<div class="project-url"> <ul> <li><a href="%1$s"%2$s>%3$s</a></li> </ul> </div>', esc_url($project_details['project_url']), $project_details['project_url_new_window'] ? ' target="_blank"' : '', esc_html($project_details['project_url_text'])); $output = sprintf('<div class="module project-details"> <div class="project-description"> <h5 class="project-title">%2$s</h5> %4$s </div> <div class="project-categories"> <h5 class="project-title">%5$s</h5> <ul> %6$s </ul> </div> <div class="project-tags"> <h5 class="project-title">%7$s</h5> <ul> %8$s </ul> </div> %9$s </div>', esc_attr(et_get_option('accent_color', '#00A8FF')), esc_html($project_details['title']), !empty($description) ? sprintf('<h5 class="project-description-title">%s</h5>', __('Project Description:', 'extra')) : '', $description, esc_html__('Categories: ', 'extra'), $categories_list, esc_html__('Skills: ', 'extra'), $skills_list, $project_url); if ($is_the_sidebar) { $output = sprintf('<div class="et_pb_extra_column_sidebar">%s</div>', $output); } echo $output; }
function extra_get_sidebar_class() { if ('product' == get_query_var('post_type')) { $post_id = empty($post_id) ? get_the_ID() : $post_id; $sidebar_location = get_post_meta($post_id, '_extra_sidebar_location', true); } else { if (is_singular()) { $post_id = empty($post_id) ? get_the_ID() : $post_id; $sidebar_location = get_post_meta($post_id, '_extra_sidebar_location', true); } else { if (is_archive()) { if ($layout_id = extra_get_tax_layout_id()) { $sidebar_location = get_post_meta($layout_id, '_extra_sidebar_location', true); } } else { if (is_home() && et_extra_show_home_layout()) { if ($layout_id = extra_get_home_layout_id()) { $sidebar_location = get_post_meta($layout_id, '_extra_sidebar_location', true); } } } } } if (empty($sidebar_location)) { if ('product' == get_query_var('post_type')) { $sidebar_location = et_get_option('woocommerce_sidebar_location', extra_global_sidebar_location()); } else { $sidebar_location = extra_global_sidebar_location(); } } // Project's sidebar location overrides if (is_singular(EXTRA_PROJECT_POST_TYPE)) { $project_details = extra_get_project_details(); if (isset($project_details['location']) && 'single_col' === $project_details['location']) { $sidebar_location = 'none'; } } $class = ''; if ('none' != $sidebar_location) { $class .= 'with_sidebar'; $class .= 'right' == $sidebar_location ? ' with_sidebar_right' : ' with_sidebar_left'; } return $class; }