function of_option_setup() { //Update EMPTY options $of_array = array(); add_option('of_options', $of_array); $template = salejunction_get_option('of_template'); $saved_options = salejunction_get_option('of_options'); $std = ''; foreach ($template as $option) { if ($option['type'] != 'heading') { $id = $option['id']; if (isset($option['std'])) { $std = $option['std']; } $db_option = salejunction_get_option($id); if (empty($db_option)) { if (is_array($option['type'])) { foreach ($option['type'] as $child) { $c_id = $child['id']; $c_std = $child['std']; salejunction_update_option($c_id, $c_std); $of_array[$c_id] = $c_std; } } else { salejunction_update_option($id, $std); $of_array[$id] = $std; } } else { //So just store the old values over again. $of_array[$id] = $db_option; } } } salejunction_update_option('of_options', $of_array); }
function of_options() { // VARIABLES $themename = 'Salejunction Theme'; $shortname = "of"; // Populate OptionsFramework option in array for use in theme global $of_options; $of_options = salejunction_get_option('of_options'); // Background Defaults $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll'); //Color Stylesheet // Pull all the categories into an array $options_categories = array(); $options_categories_obj = get_categories(); foreach ($options_categories_obj as $category) { $options_categories[$category->cat_ID] = $category->cat_name; } // Pull all the Product categories into an array $product_categories = array(); $product_categories_obj = get_terms("product_cat"); if ($product_categories_obj) { foreach ($product_categories_obj as $product_category) { if (isset($product_category->name)) { $product_categories[$product_category->term_id] = $product_category->name; } } } // Pull all the pages into an array $options_pages = array(); $options_pages_obj = get_pages('sort_column=post_parent,menu_order'); $options_pages[''] = 'Select a page:'; foreach ($options_pages_obj as $page) { $options_pages[$page->ID] = $page->post_title; } // If using image radio buttons, define a directory path $imagepath = get_stylesheet_directory_uri() . '/images/'; $options = array(array("name" => __('General Settings', 'slejunction'), "type" => "heading"), array("name" => __('Custom Logo', 'slejunction'), "desc" => __('Choose your own logo. Optimal Size: 200px Wide by 90px Height.', 'slejunction'), "id" => "salejunction_logo", "type" => "upload"), array("name" => __('Custom Favicon', 'slejunction'), "desc" => __('Specify a 16px x 16px image that will represent your websites favicon.', 'slejunction'), "id" => "salejunction_favicon", "type" => "upload"), array("name" => __('Top Feature Settings', 'slejunction'), "type" => "heading"), array("name" => __('Top Feature Image', 'slejunction'), "desc" => __('The optimal size of the image is 1920 px wide x 654 px height, but it can be varied as per your requirement.', 'slejunction'), "id" => "salejunction_slideimage1", "std" => "", "type" => "upload"), array("name" => __('Top Feature Heading', 'slejunction'), "desc" => __('Mention the heading for the Top Feature.', 'slejunction'), "id" => "salejunction_sliderheading1", "std" => "", "type" => "textarea"), array("name" => __('Link for Top Feature', 'slejunction'), "desc" => __('Mention the URL for Top Feature image.', 'slejunction'), "id" => "salejunction_Sliderlink1", "std" => "", "type" => "text"), array("name" => __('Top Feature Description', 'slejunction'), "desc" => __('Here mention a short description for the First Top Feature.', 'slejunction'), "id" => "salejunction_sliderdes1", "std" => "", "type" => "textarea"), array("name" => __('Button Text for Top Feature', 'slejunction'), "desc" => __('Mention the text for Top Feature Button.', 'slejunction'), "id" => "salejunction_slider_button1", "std" => "", "type" => "text"), array("name" => __('Home Page Category', 'slejunction'), "type" => "heading"), array("name" => __('Select WooCommerce Category List', 'slejunction'), "desc" => __('Select your product category to display your products on home page.', 'slejunction'), "id" => "salejunction_woo_cat", "std" => "false", "type" => "multicheck", "options" => $product_categories), array("name" => __('Home Page Blog Feature Section', 'slejunction'), "type" => "heading"), array("name" => __('Home Blog Heading', 'slejunction'), "desc" => __('Enter your home blog heading', 'slejunction'), "id" => "salejunction_blog_heading", "std" => "", "type" => "textarea"), array("name" => __('Home Blog Description', 'slejunction'), "desc" => __('Enter your home blog description', 'slejunction'), "id" => "salejunction_blog_desc", "std" => "", "type" => "textarea"), array("name" => __('Styling Options', 'slejunction'), "type" => "heading"), array("name" => __('Custom CSS', 'slejunction'), "desc" => __('Quickly add some CSS to your theme by adding it to this block.', 'slejunction'), "id" => "salejunction_customcss", "std" => "", "type" => "textarea")); salejunction_update_option('of_template', $options); salejunction_update_option('of_themename', $themename); salejunction_update_option('of_shortname', $shortname); }
function wocommorce_latest_downloads($args = array()) { $options = salejunction_get_option('of_template'); foreach ($options as $option) { $option_type = $option['type']; if ($option_type == 'multicheck') { foreach ($option['options'] as $key => $option1) { if ($key == '' || $key == NULL) { } else { $of_key = $option['id'] . '_' . $key; $saved_std = salejunction_get_option($of_key); if ($saved_std == 'true') { $window[] = $key; } } } } } if (!empty($window)) { $args = array('orderby' => 'id', 'order' => 'ASC', 'include' => $window, 'number' => '10'); } else { $args = array('orderby' => 'id', 'order' => 'ASC', 'number' => '10'); } $categories = get_terms('product_cat', $args); //$product_obj = new WC_Product($product); foreach ($categories as $cat) { // set query arguments $params = array('post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => 16, 'taxonomy' => 'product_cat', 'term' => $cat->slug); // create query $downloads = new WP_Query($params); // loop if ($downloads->have_posts()) { ?> <div id="<?php echo $cat->slug; ?> " class="section-latest latest"> <ul class="thumbnail"> <?php while ($downloads->have_posts()) { $downloads->the_post(); global $post, $product, $woocommerce; ?> <li> <section class="edd-image"> <?php if (has_post_thumbnail()) { ?> <?php get_post_thumbnail_id(); ?> <?php } else { ?> <?php salejunction_get_image(); ?> <?php } ?> </section> <?php if ($price_html = $product->get_price_html()) { ?> <span class="price"><?php echo $price_html; ?> </span> <?php } ?> <?php if ($product->is_on_sale()) { ?> <span class="tag-sale"></span> <?php } ?> <!-- latest-thumbnail --> <h6><a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a></h6> <section class="thumb-content"> <!-- <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> " class="latest-thumbnail"> <span class="new-link">SEE MORE</span> </a>--> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> " class="latest-thumbnail"> <section class="edd-the-price"> </section></a> <p><?php echo salejunction_custom_trim_excerpt(15); ?> </p> </section> <!-- latest-meta --> </li> <?php $categories = get_terms('product_cat', array('orderby' => 'count')); ?> <?php } ?> <span class="all_item"><?php echo $cat->name; ?> : <a href="<?php echo site_url() . '/?product_cat=' . $cat->slug; ?> " class="view_more"><?php _e('More items', 'salejunction'); ?> </a> <br/><br/> <br/><br/> </span> </ul><!-- .latest-listing --> </div><!-- .section-latest.--> <?php } } wp_reset_postdata(); }
function salejunction_of_head_css() { $output = ''; $custom_css = salejunction_get_option('salejunction_customcss'); if ($custom_css != '') { $output .= $custom_css . "\n"; } // Output styles if ($output != '') { $output = "<!-- Custom Styling -->\n<style type=\"text/css\">\n" . $output . "</style>\n"; echo $output; } }
function salejunction_optionsframework_uploader_function($id, $std, $mod) { //$uploader .= '<input type="file" id="attachement_'.$id.'" name="attachement_'.$id.'" class="upload_input"></input>'; //$uploader .= '<span class="submit"><input name="save" type="submit" value="Upload" class="button upload_save" /></span>'; $uploader = ''; $upload = salejunction_get_option($id); if ($mod != 'min') { $val = $std; if (salejunction_get_option($id) != "") { $val = salejunction_get_option($id); } $uploader .= '<input class=\'of-input\' name=\'' . $id . '\' id=\'' . $id . '_upload\' type=\'text\' value=\'' . str_replace("'", "", $val) . '\' />'; } $uploader .= '<div class="upload_button_div"><span class="button image_upload_button" id="' . $id . '">Upload Image</span>'; if (!empty($upload)) { $hide = ''; } else { $hide = 'hide'; } $uploader .= '<span class="button image_reset_button ' . $hide . '" id="reset_' . $id . '" title="' . $id . '">Remove</span>'; $uploader .= '</div>' . "\n"; $uploader .= '<div class="clear"></div>' . "\n"; $findme = 'wp-content/uploads'; $imgvideocheck = strpos($upload, $findme); if (!empty($upload) && $imgvideocheck === true) { $uploader .= '<a class="of-uploaded-image" href="' . $upload . '">'; $uploader .= '<img class="of-option-image" id="image_' . $id . '" src="' . $upload . '" alt="" />'; $uploader .= '</a>'; } $uploader .= '<div class="clear"></div>' . "\n"; return $uploader; }
</div> </div> <div class="wrapper_header"> <div class="container_24 dd-container"> <div class="grid_24"> <div class="header"> <div class="grid_6 alpha"> <div class="logo"> <?php if (salejunction_get_option('salejunction_logo') != '') { ?> <a href="<?php echo esc_url(home_url('/')); ?> "><img src="<?php echo salejunction_get_option('salejunction_logo'); ?> " alt="<?php bloginfo('name'); ?> " /></a> <?php } else { ?> <h1><a href="<?php echo esc_url(home_url()); ?> "><?php bloginfo('name'); ?> </a></h1>
<?php } else { ?> <h2> <?php _e('Show Your Latest Posts', 'salejunction'); ?> </h2> <?php } ?> <?php if (salejunction_get_option('salejunction_blog_desc') != '') { ?> <h6><?php echo salejunction_get_option('salejunction_blog_desc'); ?> </h6> <?php } else { ?> <h6> <?php _e('Here you can showcase your latest blog and let users know about your recent activities.', 'salejunction'); ?> </h6> <?php } ?> </div> <ul class="feature_content_inner_box">