/** * Add meta box */ function rockthemes_ad_add_custom_metabox() { $post_types = array('post', 'page', 'quasarproducts'); //If WooCommerce Activated, add it's product type to the $post_types if (rockthemes_woocommerce_active()) { $post_types[] = 'product'; } //This will include the sidebar foreach ($post_types as $type) { add_meta_box('rockthemes_post_details', 'Advanced Details', 'rockthemes_post_details_metabox', $type, 'normal', 'default'); } add_meta_box('rockthemes_gallery_details', 'Gallery Details', 'rockthemes_gallery_details_metabox', 'quasargallery', 'normal', 'default'); return; }
function rockthemes_pb_frontend_sidebar_after_content() { global $ROCK_CUSTOM_SIDEBAR; //Return if Rock Custom Sidebar is not activated if (!isset($ROCK_CUSTOM_SIDEBAR)) { return get_sidebar(); } $quasar_custom_sidebar_general = get_option('quasar_custom_sidebar_general'); if (rockthemes_woocommerce_active() && is_woocommerce()) { //$meta_sidebar = $quasar_custom_sidebar_general['rockthemes_woocommerce_sidebar']; } if ($quasar_custom_sidebar_general && isset($quasar_custom_sidebar_general['strict'])) { $meta_sidebar = $quasar_custom_sidebar_general['strict']; } elseif (rockthemes_woocommerce_active() && (is_woocommerce() || is_cart() || is_account_page())) { $meta_sidebar = rockthemes_cs_get_custom_sidebar_metabox(); $sidebar_exists = false; if ($meta_sidebar && is_array($meta_sidebar)) { foreach ($meta_sidebar as $meta) { if ($meta == "no-sidebar") { $sidebar_exists = true; } } } if (!$sidebar_exists) { if ($meta_sidebar && is_array($meta_sidebar)) { } else { if (isset($quasar_custom_sidebar_general['rockthemes_woocommerce_sidebar'])) { $meta_sidebar = $quasar_custom_sidebar_general['rockthemes_woocommerce_sidebar']; } elseif (!$meta_sidebar || !is_array($meta_sidebar)) { return get_sidebar(); } } } } else { $meta_sidebar = rockthemes_cs_get_custom_sidebar_metabox(); $sidebar_exists = false; if ($meta_sidebar && is_array($meta_sidebar)) { foreach ($meta_sidebar as $meta) { if ($meta == "no-sidebar") { $sidebar_exists = true; } } } if (!$sidebar_exists) { if ($meta_sidebar && is_array($meta_sidebar)) { } else { if (isset($quasar_custom_sidebar_general['regular'])) { $meta_sidebar = $quasar_custom_sidebar_general['regular']; } elseif (!$meta_sidebar || !is_array($meta_sidebar)) { return get_sidebar(); } } } } $all_sidebars = get_option('quasar_custom_sidebar_data', false); if (!$all_sidebars) { return get_sidebar(); } $sidebar_align; $sidebar_column; $elem_found = false; $left_sidebars = array(); foreach ($all_sidebars as $sidebar) { foreach ($meta_sidebar as $meta) { if (rockthemes_cs_generate_sidebar_slug($sidebar['name'], 45) == $meta) { if ($sidebar['align'] != "rightright" && $sidebar['align'] != "right") { continue; } $sidebar_align = $sidebar['align']; $sidebar_column = $sidebar['column']; $left_sidebars[] = array('align' => $sidebar['align'], 'column' => $sidebar['column'], 'slug' => $meta); $elem_found = true; break; } } } if (!$elem_found) { return; } $i = 0; foreach ($left_sidebars as $left) { if ($left['align'] == 'right') { echo '<div class="sidebar-area large-' . $left['column'] . ' column">'; echo '<div class="right-sidebar-padding">'; dynamic_sidebar($left['slug']); echo '</div>'; echo '</div>'; array_splice($left_sidebars, $i, 1); } $i++; } foreach ($left_sidebars as $left) { echo '<div class="sidebar-area large-' . $left['column'] . ' column">'; echo '<div class="right-sidebar-padding">'; dynamic_sidebar($left['slug']); echo '</div>'; echo '</div>'; } }
function quasar_before_page_content() { global $post, $wp_query, $quasar_disable_regular_title, $rockthemes_advanced_post_details; $rockthemes_advanced_post_details = rockthemes_ad_get_post_details_metabox(); $current_page_id = $wp_query->get_queried_object_id(); echo '</div></div>'; if (isset($rockthemes_advanced_post_details['disable_title_breadcrumbs_area']) && $rockthemes_advanced_post_details['disable_title_breadcrumbs_area'] === 'true') { //Do not include anything if disabled if (rockthemes_woocommerce_active() && is_woocommerce()) { remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); } } elseif (xr_get_option('disable_breadcrumbs_title_area', false)) { //Get the title and breadcrumb template //get_template_part('title','default'); $quasar_disable_regular_title = true; } else { //Get the title and breadcrumb template get_template_part('title', 'default'); $quasar_disable_regular_title = true; } //Deactivate regular title entirely $quasar_disable_regular_title = true; if (isset($rockthemes_advanced_post_details['activate_space_under_menu'])) { if ($rockthemes_advanced_post_details['activate_space_under_menu'] === 'true') { //Add extra vertical spacing echo '<div class="vertical-space"></div>'; } } elseif (!xr_get_option('disable_space_under_header', false)) { //Add extra vertical spacing echo '<div class="vertical-space"></div>'; } echo '<div class="row">'; }
//Get Theme Options details $logo = xr_get_option('company_logo', ''); $social_icons = json_decode(xr_get_option('social_icons', ''), true); $header_contact_info = xr_get_option('header_contact_info', ''); $use_header_top_2 = false; //Add Html tags to elements $logo_html = '<div class="logo-container"><a href="' . (function_exists('icl_get_home_url') ? icl_get_home_url() : get_site_url()) . '"><img src="' . $logo . '" alt="' . get_bloginfo('name') . '" style="max-width:' . xr_get_option('logo_width', '190px') . '; max-height:' . xr_get_option('logo_height', '80px') . '; width:100%;" /></a></div>'; $social_html = '<div class="header-social-container">' . do_shortcode($social_icons['shortcode']) . '</div>'; $header_contact_html = '<div class="header-small-contact">' . $header_contact_info . '</div>'; ob_start(); do_action('icl_language_selector'); $wpml_select = ob_get_contents(); $wpml_select = '<div class="header-wpml-container">' . $wpml_select . '</div>'; ob_get_clean(); $add_woo_icon_to_menu = rockthemes_woocommerce_active() && xr_get_option('add_cart_icon_to_menu', false) ? true : false; if ($add_woo_icon_to_menu) { add_filter('wp_nav_menu_items', 'rockthemes_add_cart_icon_to_menu', 10, 2); } $menu_shadow = xr_get_option('activate_menu_bottom_shadow', '1') !== '' ? quasar_image_shadow_down() : ''; /* ** Header Models ** ** 1 - Full width menu, Left Logo, Right Middle Social Icons, Right Top Call Us, Right Bottom WPML ** 2 - Full width menu, Centered Logo, Left Bottom Social Icons, Left Top Call Us, Right Top WPML ** 3 - Right menu, Left Logo, ** 4 - Full width menu, Left Logo, Right Middle Social Icons, Right Top Call Us, Right Bottom WPML ** ** ** */
function rockthemes_excerpt_title_option($selected = '') { $return = ''; $return .= ' <select class="excerpt_title_option"> <option value="no_description" ' . ($selected == 'no_description' ? 'selected' : '') . '>No Description</option> <option value="title" ' . ($selected == 'title' ? 'selected' : '') . '>Only Title</option> <option value="excerpt" ' . ($selected == 'excerpt' ? 'selected' : '') . '>Only Excerpt</option> <option value="title_excerpt" ' . ($selected == 'title_excerpt' ? 'selected' : '') . '>Title and Excerpt</option> '; //Check if WooCommerce is activated //WooCommerce currently disabled for better visualization if (rockthemes_woocommerce_active() && 1 == 0) { $return .= ' <option value="price" ' . ($selected == 'price' ? 'selected' : '') . '>Only Price</option> <option value="title_price" ' . ($selected == 'title_price' ? 'selected' : '') . '>Title and Price</option> <option value="excerpt_price" ' . ($selected == 'excerpt_price' ? 'selected' : '') . '>Excerpt and Price</option> <option value="title_excerpt_price" ' . ($selected == 'title_excerpt_price' ? 'selected' : '') . '>Title, Excerpt and Price</option> '; } $return .= '</select>'; return $return; }
} else { echo get_the_title(get_queried_object_id()); } } } ?> </h1> </div> <?php if (!xr_get_option('deactivate_breadcrumbs', false)) { ?> <div class="large-5 medium-5 columns breadcrums-container right-text centered-text-responsive-small"> <p><br /></p> <?php if (rockthemes_woocommerce_active() && is_woocommerce()) { woocommerce_breadcrumb(); //Remove WooCommerce Breadcrumb remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); } else { ?> <?php quasar_breadcrumb(); ?> <?php } ?> <div class="clear"></div> </div> <?php }
function rockthemes_gallery_load_more($atts) { if (!isset($atts)) { return; } global $paged; extract($atts); //Hover Details for the image $hover_obj = array('activate_hover_box' => sanitize_text_field($activate_hover_box), 'activate_hover' => sanitize_text_field($activate_hover), 'disable_hover_link' => sanitize_text_field($disable_hover_link), 'small_thumb_hover' => sanitize_text_field($small_thumb_hover)); //Columns Class $block_class = ' large-block-grid-' . esc_attr($block_grid_large) . ' medium-block-grid-' . esc_attr($block_grid_medium) . ' small-block-grid-' . esc_attr($block_grid_small) . ' '; if ($masonry === 'true') { $block_class .= ' rockthemes-masonry '; } //Only one hover effect can be used if ($activate_hover_box === 'true') { $activate_hover = 'false'; } //$id = "quasar-portfolio-".$GLOBALS['rockthemes_gallery']; $post_is_tax = false; $tax_list = get_object_taxonomies(sanitize_text_field($post_type)); //get_object_taxonomies $post_tax; foreach ($tax_list as $tax) { if (strpos($tax, 'cat') > -1) { $post_tax = $tax; break; } } if (get_query_var('paged')) { //Works for the pages called from index.php $paged = get_query_var('paged'); } elseif (get_query_var('page')) { //Works for the shortcodes $paged = get_query_var('page'); } else { $paged = 1; } //$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $posts = array(); if ($post_type === 'post') { $posts = query_posts(array('category_name' => esc_attr($category), 'posts_per_page' => (int) $total, 'offset' => (int) $offset, 'paged' => $paged)); } if (!count($posts)) { $args = array('post_type' => sanitize_text_field($post_type), esc_attr($post_tax) => esc_attr($category), 'posts_per_page' => (int) $total, 'offset' => (int) $offset, 'paged' => $paged); $posts = query_posts($args); $post_is_tax = true; } $return = ''; //if($boxed_layout == "true") $return .= '<div class="boxed-layout boxed-colors quasar-portfolio padding-2x">'; $return .= '<div id="' . $id . '" class="quasar-portfolio-container grid ' . ($use_shadow === 'true' ? 'use-shadow' : '') . ' ' . ($boxed_layout === 'true' ? 'boxed_layout_holder' : '') . '">'; if ($header_title != '') { //Header for hybrid layout - Grid and List $return .= '<div class="quasar-portfolio-header">'; if ($header_title != '') { $return .= '<div class="quasar-portfolio-main-title">' . sanitize_text_field($header_title) . '</div>'; } $return .= '<div class="clear"></div> </div> <br/> '; } //Body $return .= '<ul class="quasar-portfolio-body ' . $block_class . '" class-ref="' . $block_class . '">'; if (isset($is_ajax) && $is_ajax === 'true') { $return = ''; } if (sizeof($posts) > 0) { $count_columns = 1; foreach ($posts as $post_object) { global $post, $rockthemes_advanced_details; $post = $post_object; setup_postdata($post); $rockthemes_advanced_details = get_post_meta($post->ID, 'advanced_post_details', true); $cat_list = wp_get_post_terms($post->ID, $post_tax); $link_html = ''; $total_cat = count($cat_list); $c = 0; foreach ($cat_list as $cat) { $tax = get_category_by_slug($cat->slug); if (!$tax) { $tax = get_term_link($cat->slug, $post_tax); } else { $tax = get_category_link($post_tax); } $link_html .= '<a href="' . $tax . '">' . $cat->name . '</a>'; $c++; if ($c < $total_cat) { $link_html .= ', '; } } $featuredBig = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'ajax-filtered-hover'); if ($featuredBig) { $featuredBig = $featuredBig[0]; } else { $featuredBig = wp_get_attachment_url(get_post_thumbnail_id($post->ID)) && !$featuredBig ? wp_get_attachment_url(get_post_thumbnail_id($post->ID)) : 'no-image'; } $thumbnail = wp_get_attachment_image(get_post_thumbnail_id($post->ID), $image_size); $title = $thumbnail ? $thumbnail : $post->post_title; if ($use_swiper_for_thumbnails === 'true') { $title = rockthemes_make_swiperslider_shortcode($post->ID, $image_size); } $link = get_post_permalink($post->ID); $excerpt = rock_check_p($post->post_excerpt); $product_price = ''; if (get_post_meta($post->ID, '_sale_price', true) != '' && rockthemes_woocommerce_active()) { $product_price = woocommerce_price(get_post_meta($post->ID, '_sale_price', true)); $excerpt = '<div class="remove-foundation-padding"><div class="large-9 columns">' . rock_check_p($post->post_excerpt) . '</div><div class="price-holder large-3 columns right-text">' . $product_price . '</div></div>'; } if ($link != '' && $activate_hover != 'true') { $title = '<div class="relative-container rockthemes-hover"><a href="' . esc_url($link) . '">' . $title . '</a></div>'; } if ($activate_hover == 'true') { $hover_effect = quasar_hover_effect($post->ID, $use_shadow === 'true' ? true : false, $disable_hover_link !== 'false' ? false : true); $title = '<div class="relative-container rockthemes-hover">' . $title . $hover_effect . '</div>'; } $description = ''; $list_description = ''; $desc_details = explode('_', $excerpt_title_option); $desc_details_price_active = false; if (strpos($excerpt_title_option, 'price') > -1) { $desc_details_price_active = true; } $desc_details_excerpt_active = false; if (strpos($excerpt_title_option, 'price') > -1) { $desc_details_excerpt_active = true; } if ($excerpt_title_option != "no_description") { foreach ($desc_details as $detail) { switch ($detail) { case 'title': if ($activate_header_link === 'false') { $description .= '<p class="quasar-portfolio-title">' . get_the_title() . '</p>'; } else { $description .= '<p class="quasar-portfolio-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></p>'; } if ($activate_category_link === 'true') { //Check if user activates the category link $description .= '<p class="quasar-portfolio-category-link">' . $link_html . '</p>'; } break; case 'excerpt': /* ** WooCommerce ** if($desc_details_price_active) $description .= '<div class="row"><div class="large-9 columns">'; */ if ($desc_details_price_active) { $description .= '<div>'; } $description .= '<p class="quasar-portfolio-excerpt">' . rockthemes_excerpt($post->post_excerpt, $excerpt_length) . '</p>'; if ($desc_details_price_active) { $description .= '</div>'; } /* Read More for products. Currently stopped for using buttons. Works without a problem if($desc_details_price_active) $list_description .= '<div class="row"><div class="large-9 columns">'; $list_description .= '<p class="quasar-portfolio-excerpt">'.rock_check_p(($post->post_excerpt).quasar_read_more()).'</p>'; if($desc_details_price_active) $list_description .= '</div>'; */ break; case 'price': /* TO DO : WooCommerce Price Field. Works but needs visual improvments. if($desc_details_excerpt_active) $description .= '<div class="large-3 columns">'; $description .= '<p class="quasar-price">'.$product_price.'</p>'; if($desc_details_excerpt_active) $description .= '</div></div>'; if($desc_details_excerpt_active) $list_description .= '<div class="large-3 columns">'; $list_description .= '<p class="quasar-price">'.$product_price.'</p>'; if($desc_details_excerpt_active) $list_description .= '</div></div>'; */ break; } } } $boxed_cover_html_pre = ''; $boxed_cover_html_after = ''; $boxed_cover_html_class = ''; $boxed_cover_list_before = ''; $boxed_cover_list_after = ''; if ($boxed_layout == "true") { $boxed_cover_html_pre = '<div class="boxed_layout_holder boxed-layout boxed-colors columns" ref="boxed-layout boxed-colors">'; $boxed_cover_html_after = '</div>'; $boxed_cover_html_class = 'boxed-layout boxed-colors quasar-portfolio'; } $return .= $boxed_cover_list_before . '<li featured-big="' . $featuredBig . '">' . $title . $boxed_cover_html_pre . '<div class="grid-description">' . $description . '</div><div class="list-description ' . ($boxed_layout === 'true' ? 'large-7 medium-7 columns' : '') . '" class-ref="7">' . $list_description . '</div>' . $boxed_cover_html_after . '</li>' . $boxed_cover_list_after; } } else { $return .= '<div class="large-12 columns">' . __("No data found!", "quasar") . '</div>'; } if (!isset($is_ajax) || isset($is_ajax) && $is_ajax === 'false') { $return .= '</ul>'; //End of Body $return .= '<div class="clear"></div>'; if ($pagination === 'true') { //Footer navigation $return .= quasar_paging_nav(); } wp_reset_query(); wp_reset_postdata(); $args['posts_per_page'] = -1; $args['paged'] = 0; $args['nopaging'] = true; $total_query = new WP_Query($args); $return .= '<div class="total-posts-number-holder hide" data-query-total="' . $total_query->found_posts . '"></div>'; $return .= '</div>'; //End of HTML field } //var_dump(wp_count_posts()); return $return; }