$option ){ wts_reset_get_option('themeshock'.$option.'_option', 'false'); } }; (isset($GLOBALS['display_elements']) && $GLOBALS['display_elements'][2] == 'show')?wts_reset_get_option($shortname.'_show_search_box', 'true'):wts_reset_get_option($shortname.'_show_search_box', 'false'); update_option('themeshock_layout_options', maybe_serialize($layout_info)); } function wts_main_boxes(){ if(get_option('themeshock_default_post_boxes') == 'true'){ if(isset($GLOBALS['boxes_css']) && $GLOBALS['boxes_css'][1] != 'boxcss_default'){ return 'reset_boxcss '.$GLOBALS['boxes_css'][1]; }else{ return $GLOBALS['boxes_css'][1]; } }else if(get_option('themeshock_postsbox_style') != 'boxcss_default'){ return 'reset_boxcss '.get_option('themeshock_postsbox_style'); }else{ return get_option('themeshock_postsbox_style'); } } $font_style_pack = array( "Yanone Kaffeesatz", "Wire One", "Ubuntu", "Rokkitt", "Righteous", "Raleway", "Quattrocento Sans", "PT Sans", "Open Sans","Nixie One", "News Cycle", "Acme","Coustard", "Alfa Slab One", "Abel", "Brawler", "Droid Sans", "Crushed","Cabin Condensed", "Federo", "Arimo", "Contrail One", "Anton", "Days One","Droid Serif", "Abril Fatface", "Allan","Amatic SC", "Anonymous Pro", "Bangers","Baumans", "Boogaloo", "Bree Serif","Buda", "Cuprum", "Damion","Dorsa", "Francois One", "Just Another Hand","Gruppo", "Jockey One", "Maiden Orange", "Josefin Slab", "Lobster", "Lobster Two", "Marvel", "Andika", "Arial","Verdana", "Tahoma", "Trebuchet MS"); /* Spanish Translations*/ load_theme_textdomain( 'tstranslate', TEMPLATEPATH.'/functions/languages' ); $locale = get_locale(); $locale_file = get_template_directory_uri()."/functions/languages/$locale.php"; if ( is_readable($locale_file) ){ require_once($locale_file); } add_action( 'admin_enqueue_scripts', 'add_slider' ); add_action( 'admin_enqueue_scripts', 'light_box' ); if ( ! isset( $content_width ) ) $content_width = 960; /*Header and Background styles*/ /* add_custom_background(); define('HEADER_TEXTCOLOR', 'ffffff'); define('HEADER_IMAGE', '%s/img/header_bkg.jpg'); // %s is the template dir uri function header_style() { ?> 'Shock Menu: place the menu you want as primary navigation.', 'optional_topbar' => 'Top bar Menu')); } $categories = get_categories('hide_empty=0&orderby=name'); $wp_cats = array(); foreach ($categories as $category_list ) { $wp_cats[$category_list->cat_ID] = $category_list->cat_name; } array_unshift($wp_cats, "Choose a category"); function themeshock_add_admin() { global $themename, $shortname, $wpdb; if ( isset($_GET['page']) == basename(__FILE__) ) { if ( 'save' == isset($_REQUEST['action']) ) { foreach ($_POST as $option_name => $newvalue) { switch($option_name){///parta evitar datos basura del layout generator case 'top_1_style': case 'top_2_style': case 'left_1_style': case 'left_2_style': case 'right_1_style': case 'right_2_style': case 'bottom_1_style': case 'bottom_2_style': case 'slider_blog': case 'slider_single': case 'slider_search': case 'slider_archive': case 'slider_category': case 'footer_widget_style': case 'themeshock_featured': case 'ft_size': break; default: update_option( $option_name, $newvalue ); break; } } } } add_object_page($themename, $themename, 'administrator', basename(__FILE__), 'themeshock_admin'); } function themeshock_add_init() { $file_dir = get_template_directory_uri(); wp_enqueue_style("functions", $file_dir."/functions/functions.css", true, "1.0", "all"); //wp_enqueue_style("colorbox", $file_dir."/css/colorbox.css", true, "1.0", "all"); wp_enqueue_script('comment-reply'); add_editor_style(); } /*********************/ /* Setup font style */ /*******************/ function get_wptg_font_style(){ global $themename, $shortname, $font_style_pack; $headings = array('H1', 'H2', 'H3', 'H4', 'H5', 'H6'); ?>
Body (paragraphs)
Color " name="" id=""/>
Headings (Titles)
Color " name="" id="" />
(Inherit) Inherit from downloaded theme
(Color) Use hex, rgb, hsl or color name eg(#333, rgb(200, 200, 200), hsl(0, 0%, 20%) or blue)
value="true"/>
value="true"/>
/> - ':''; }?>
'galleries','portfolio'=>'portfolios', 'services'=>'brochures');?>
value="true"/>
$option_save){?>
/>
Disable/enable custom post type (Gallery, Portfolio, Products, Services, Testimonials) value="true"/>
Font Color custom post type (Gallery, Portfolio, Products, Services, Testimonials)
(Font Color) Use hex, rgb, hsl or color name eg(#333, rgb(200, 200, 200), hsl(0, 0%, 20%) or blue)
value="true"/>
/>
URL where you will receive payment parameters: Parameters to pass (Post method):
$_POST['tg_shp_cart'][idproduct]['title']=Prints product name $_POST['tg_shp_cart'][idproduct]['quantity']=Prints product quantity $_POST['tg_shp_cart'][idproduct]['price']=Prints the total price for the quantity of such product according to the price defined in Edit product item $_POST['tg_shp_cart'][price_total]=Prints total price of all products $_POST['tg_shp_cart'][total_items]=Prints total quantity of items of all products $_POST['tg_shp_cart'][currrency]=Prints the currency selected at Options for Theme Generator
value="true"/>
> Uploader images
    $slider_info){?>
  1. data-id="" />
$value ){ if (is_array($value)){ $disable=($value["active"]===true)?'style="z-index:2;"':' disabled="disabled" '; if($GLOBALS['layout_info']['themeshock_default_widget_boxes'] == true && $disable != ' disabled="disabled" '){ $default_widgets_boxes = ' disabled="disabled" '; } $value_assigned=$value["style"]; $array_search=array($name_base,'value="'.$value_assigned.'"'); $array_replace=array('name="'.$style_widget_name.'_style"'.$disable.$default_widgets_boxes,'value="'.$value_assigned.'" selected="selected"'); $select_position[$style_widget_name]=str_replace($array_search,$array_replace,$widget_style_option); } if ($style_widget_name==='footer_widget_style'){ $select_position[$style_widget_name]=str_replace('value="'.$value.'"','value="'.$value.'" selected="selected"',$widget_style_option); } } ?>
/>
/>
Top Bottom
...

'.$themename.' settings saved.

'; if ( isset($_POST['reset'] )) echo '

'.$themename.' settings reset.

'; add_meta_box('wptg-font-style', 'Font Style', 'get_wptg_font_style', 'toplevel_page_functions', 'wptg_font_style', 'core'); add_meta_box('wptg-logo', 'Logo', 'get_wptg_logo', 'toplevel_page_functions', 'wptg_logo', 'core'); add_meta_box('wptg-header_elements', 'Menu and Search', 'getThemeGenHeaderElements', 'toplevel_page_functions', 'wptg_header_elements', 'core'); add_meta_box('wptg-shortcodes', 'Custom Post Type Shortcodes', 'getThemeGenShortcodes', 'toplevel_page_functions', 'wptg_shortcodes', 'core'); add_meta_box('wptg-metatags-favicon', 'Meta Tags and Favicon', 'getThemeGenMetaTagsFavicon', 'toplevel_page_functions', 'wptg_metatags_favicon', 'core'); add_meta_box('wptg-posts', 'Posts Display Options', 'getThemeGenPosts', 'toplevel_page_functions', 'wptg_posts', 'core'); add_meta_box('wptg-icon-posts', 'Icon Post', 'getThemeGenIconPost', 'toplevel_page_functions', 'wptg_icon_posts', 'core'); add_meta_box('wptg-socials-networks', 'Social Networks', 'getThemeGenSocialNetworks', 'toplevel_page_functions', 'wptg_social_networks', 'core'); add_meta_box('wptg-contact-form', 'Contact Form', 'getThemeGenContactForm', 'toplevel_page_functions', 'wptg_contact_form', 'core'); add_meta_box('wptg-custom-post-types', 'Options Custom Post Types', 'getThemeGenCustomPostTypes', 'toplevel_page_functions', 'wptg_custom_post_types', 'core'); add_meta_box('wptg-responsive', 'Responsive', 'getThemeGenResponsive', 'toplevel_page_functions', 'wptg_responsive', 'core'); add_meta_box('wptg-footer-info', 'Footer Info', 'getThemeGenFooterInfo', 'toplevel_page_functions', 'wptg_footer_info', 'core'); add_meta_box('wptg-google-analytics', 'Google Analytics', 'getThemeGenGoogleAnalytics', 'toplevel_page_functions', 'wptg_google_analytics', 'core'); add_meta_box('wptg-shopping-cart', 'Shopping Cart', 'getThemeGenShoppingCart', 'toplevel_page_functions', 'wptg_shopping_cart', 'core'); add_meta_box('wptg-tool-wptg', 'Personalize Menu', 'getThemeGenToolWptg', 'toplevel_page_functions', 'wptg_tool_wptg', 'core'); add_meta_box('wptg-testimonial-quotes', 'Testimonial Quotes', 'getThemeGenTestimonialQuotes', 'toplevel_page_functions', 'wptg_testimonial_quotes', 'core'); add_meta_box('wptg-slider', 'Slider', 'getThemeGenSlider', 'toplevel_page_functions', 'wptg_slider', 'core'); add_meta_box('wptg-page-layout', 'Layout Creator', 'getThemeGenPageLayout', 'toplevel_page_functions', 'wptg_page_layout', 'core'); ?>

Icons: Iconshock
  • id="li-comment-">
    %s - ', get_comment_author_link()) ?>
    $depth, 'max_depth' => $args['max_depth']))) ?>
    ID); $feat_post = $custom["feat_post"][0]; ?>
    checked="checked" />
    ID, "feat_post", $_POST["feat_post"]); }else{ update_post_meta($post->ID, "feat_post", 'off'); } } /**********************/ /* Remove Title Page */ /********************/ add_action('admin_init', 'remove_title_page'); add_action('save_post', 'update_remove_title_page'); function remove_title_page(){ add_meta_box("page_details", __("More page options",'tstranslate'), "page_options", "page", "side", "default"); } function page_options(){ global $post; $custom = get_post_custom($post->ID); $remove_title = $custom["remove_title_page"][0]; $removeBoxContent = $custom["remove_box_content"][0]; ?>
    />
    />
    ID, "remove_title_page", $_POST["remove_title_page"]); update_post_meta($post->ID, "remove_box_content", $_POST["remove_box_content"]); }else{ update_post_meta($post->ID, "remove_title_page", 'off'); update_post_meta($post->ID, "remove_box_content", 'off'); } } function layout_update(){ foreach ($GLOBALS['pages'] as $page){ if (!isset($GLOBALS['layout_info'][$page->ID])){ $GLOBALS['layout_info'][$page->ID]['slider_page']=true;/// asigna slider dependiendo el id del pageel blog o home el caso es el 0 $GLOBALS['layout_info'][$page->ID]['footer_widget_style']=$GLOBALS['style_widgets_default'];//asignar estilos al footer foreach($GLOBALS['sidebar_info'] as $position_widgets => $description ){//asignar estilos y posiciones en el layout $GLOBALS['layout_info'][$page->ID][$position_widgets]['active']=($position_widgets==='right_1')?true:false;//define layout habilitado por default en este caso es right_1 $GLOBALS['layout_info'][$page->ID][$position_widgets]['style']=$GLOBALS['style_widgets_default']; } } } update_option('themeshock_layout_options',maybe_serialize($GLOBALS['layout_info'])); } layout_update();///actualiza los pages en los layouts automaticamente function widget_style($position,$id){// es la funcion que modifica los estilos de los widgets global $wp_registered_sidebars; $default_boxes_widgets = $GLOBALS['layout_info']['themeshock_default_widget_boxes']; if($default_boxes_widgets == true){ $idw= $idw= $GLOBALS['boxes_css'][0]; }else{ if($id != 'boxcss_default'){ //$id = ID style box $idw= $idw=($id===NULL)?'boxcss_0':$id; }else{ (isset($GLOBALS['boxes_css']) && $GLOBALS['boxes_css'][0] != 'boxcss_0')?$idw=$GLOBALS['boxes_css'][0]:$idw=($id===NULL)?'boxcss_0':$id; } } $idw .= ' boxcss'; //$widget_boxescss = (isset($GLOBALS['boxes_css']) && $GLOBALS['boxes_css'][0] != '0')?$GLOBALS['boxes_css'][0]:'noneee'; //////////////////////////////////////////////////////////////////// // $GLOBALS['style_widgets_default'] Borarr importante!!!! //////////////////////////////////////////////////////////////////// $the_sidebars = wp_get_sidebars_widgets(); //echo 'widgets_ss'.$id; foreach ($wp_registered_sidebars as $all_sidebars){ $sidebar_id = $all_sidebars['id']; if($all_sidebars['name'] == $position)break; } $reset_boxes = ''; ($default_boxes_widgets != true && $id != "boxcss_default")?$reset_boxes = 'reset_boxes':''; $count_wid = count($the_sidebars[$sidebar_id]); ($count_wid >= 4)?$count_wid = 4:NULL; $class_originals=array('
    ', 'container_widgets_pieces', 'widget_corner widget_top_left', 'widget_token_left', 'widget_topbottom widget_top_center', 'widget_corner widget_top_right', 'widget_token_right', 'widget_sides widget_middle_left', 'widget_center widget_content', 'widget_sides widget_middle_right', 'widget_corner widget_bottom_left', 'widget_topbottom widget_bottom_center', 'widget_corner widget_bottom_right', 'widget_token_bottom' ); $new_classes=array('
    ', 'container_widgets_pieces '.$reset_boxes, 'widget_corner widget_top_left '.$reset_boxes, 'widget_token_left '.$reset_boxes, 'widget_topbottom widget_top_center '.$reset_boxes, 'widget_corner widget_top_right '.$reset_boxes, 'widget_token_right '.$reset_boxes, 'widget_sides widget_middle_left '.$reset_boxes, 'widget_center widget_content '.$reset_boxes, 'widget_sides widget_middle_right '.$reset_boxes, 'widget_corner widget_bottom_left '.$reset_boxes, 'widget_topbottom widget_bottom_center '.$reset_boxes, 'widget_corner widget_bottom_right '.$reset_boxes, 'widget_token_bottom '.$reset_boxes ); ob_start(); dynamic_sidebar($position); $sidebar_contents = ob_get_clean(); echo str_replace($class_originals,$new_classes,$sidebar_contents); } function update_layout(){ $layout_pack=array(); foreach($GLOBALS['pages'] as $index => $page){//$GLOBALS['pages'] ver en functions/variables_load.php if ($page->ID===0){// asignar slider para el single post,search,archive y category $layout_pack[$page->ID]['slider_blog']=true; $layout_pack[$page->ID]['slider_single']=true; $layout_pack[$page->ID]['slider_search']=false; $layout_pack[$page->ID]['slider_archive']=false; $layout_pack[$page->ID]['slider_category']=false; $layout_pack['themeshock_default_widget_boxes'] = true; } else{ $layout_pack[$page->ID]['slider_page']=true;/// asigna slider dependiendo el id del pageel blog o home el caso es el 0 } $layout_pack[$page->ID]['footer_widget_style']=$GLOBALS['style_widgets_default'];//asignar estilos al footer foreach($GLOBALS['sidebar_info'] as $position_widgets=> $description ){//asignar estilos y posiciones en el layout $layout_pack[$page->ID][$position_widgets]['active']=($position_widgets==='right_1')?true:false;//define layout habilitado por default en este caso es right_1 $layout_pack[$page->ID][$position_widgets]['style']=$GLOBALS['style_widgets_default']; } } update_option('themeshock_layout_options',maybe_serialize($layout_pack));//regitrar layout en los didebar return $layout_pack;//carga todas las posiciones de los layouts; } function update_sidebar(){ $sidebars=array(); foreach($GLOBALS['position_lay_widgets'] as $position_widgets ){ $sidebars[$position_widgets]=$GLOBALS['register_sidebar']; $sidebars[$position_widgets]['name']=$position_widgets; } update_option('themeshock_sidebar',maybe_serialize($sidebars));//registra un sidebar en las posisciones return $sidebars; } function update_slider_info(){ $upload_dir=wp_upload_dir(); if (isset($upload_dir["error"]) && $upload_dir["error"]!==false ){ $GLOBALS['error_folder']= 'The option to change logo and slider is disabled, please create the following folder: /wp-content/uploads/ and allow writing by setting its permissions to 0777'; return false; } $directory_slider=$upload_dir['basedir']."/slider/"; mkdir($directory_slider,0777,true); $directory_slider_base=get_template_directory()."/img/slider/{*.jpg,*.png,*.gif,*.bmp}"; $img_directory_pack=glob($directory_slider_base,GLOB_BRACE); $slider_info= array(); foreach($img_directory_pack as $index => $img_slider_info){ $get_info_img=getimagesize($img_slider_info); $slider_info[$index]['active']=true; $slider_info[$index]['link']='#'; $slider_info[$index]['url']=$upload_dir['baseurl'].'/slider/'.basename($img_slider_info); $slider_info[$index]['path']=$upload_dir['basedir'].'/slider/'.basename($img_slider_info); @chmod($slider_info[$index]['path'],0777); $slider_info[$index]['thumbnail']=$upload_dir['baseurl'].'/slider/'.basename(image_resize($slider_info[$index]['path'],200,200)); @chmod($slider_info[$index]['thumbnail'],0777); } update_option('themeshock_slider_dimensions',maybe_serialize($get_info_img));/// guarda las dimenssiones de la imagen update_option('themeshock_slider_images',maybe_serialize($slider_info)); $GLOBALS['slider_img_info']=$slider_info; return $slider_info; } function update_logo_info(){ $upload_dir=wp_upload_dir(); if (isset($upload_dir["error"]) && $upload_dir["error"]!==false ){ $GLOBALS['error_folder']= 'The option to change logo and slider is disabled, please create the following folder: /wp-content/uploads/ and allow writing by setting its permissions to 0777'; return false; } $directory_logo=$upload_dir['basedir'].'/logo/'; $get_img_logo=get_template_directory_uri().'/img/logo/logo.png'; $get_dimmensions=getimagesize($get_img_logo); $logo_info['path']=$upload_dir['basedir'].'/logo/logo.png'; $logo_info['url']=$upload_dir['baseurl'].'/logo/logo.png'; $logo_info['size']=$get_dimmensions; @mkdir($directory_logo,0777,true); chmod($logo_info['path'],0777); update_option('themeshock_logo',maybe_serialize($logo_info)); return $logo_info; } function display_elements($element_block){ if(isset($GLOBALS['display_elements']) && $_SERVER['SERVER_NAME'] == 'www.wpthemegenerator.com'){ switch($GLOBALS['display_elements'][$element_block]){ case 'show': return 'show_element'; break; case 'hide': return 'hide_element'; break; } } } function get_attr_logo(){ $eff_logo = $style_logo = $img_logo = NULL; if($GLOBALS['logo_type'] == 'text'){ $eff_logo = 'logo_effect_'.strtolower($GLOBALS['logo_text_options']['logo_effect']); $style_logo = 'font-size: '.$GLOBALS['logo_text_options']['logo_text_font_size'].';'; if($GLOBALS['logo_text_options']['logo_font_family'] != 'Default'){ $style_logo .= 'font-family: "'.$GLOBALS['logo_text_options']['logo_font_family'].'", sans-serif;'; } }; $style_attr = ($style_logo != "")?"style='".$style_logo."'":""; $src_logo = ($GLOBALS['logo_info'])?$GLOBALS['logo_info']['url']:get_template_directory_uri(); if($GLOBALS['logo_type'] == 'image'){ $img_logo = ''; }else{ $img_logo = ''.$GLOBALS['logo_text_options']['logo_text'].''; } return ''; } function trim_excerpt($text) { return str_replace(" [...]", '...', $text); } add_filter('get_the_excerpt', 'trim_excerpt'); function trim_the_content( $the_contents, $read_more_tag = ' READ MORE...', $perma_link_to = '', $all_words = 45 ) { $allowed_tags = array( 'a', 'abbr', 'b', 'blockquote', 'b', 'cite', 'code', 'div', 'em', 'fon', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'label', 'i', 'p', 'pre', 'span', 'strong', 'title', 'ul', 'ol', 'li', 'object', 'embed', 'input' ); if( $the_contents != '' ) { $allowed_tags = '<' . implode( '><', $allowed_tags ) . '>'; $the_contents = str_replace( ']]>', ']]>', $the_contents ); $the_contents = strip_tags( $the_contents, $allowed_tags ); if( $all_words > count( preg_split( '/[\s]+/', strip_tags( $the_contents ), -1 ) ) ) return $the_contents; $all_chunks = preg_split( '/([\s]+)/', $the_contents, -1, PREG_SPLIT_DELIM_CAPTURE ); $the_contents = ''; $count_words = 0; $enclosed_by_tag = false; foreach( $all_chunks as $chunk ) { if( 0 < preg_match( '/<[^>]*$/s', $chunk ) ) $enclosed_by_tag = true; elseif( 0 < preg_match( '/>[^<]*$/s', $chunk ) ) $enclosed_by_tag = false; if( !$enclosed_by_tag && '' != trim( $chunk ) && substr( $chunk, -1, 1 ) != '>' ) $count_words ++; $the_contents .= $chunk; if( $count_words >= $all_words && !$enclosed_by_tag ) break; } $the_contents = $the_contents . '' . $read_more_tag . ''; $the_contents = force_balance_tags( $the_contents ); } return $the_contents; } function statusCustomPostType($wtsPostName, $wtsStatus){ global $wpdb, $post; (isset($_POST['themeshock_enablePostTypeGallery']) || isset($_POST['themeshock_enablePostTypePortfolio']) || isset($_POST['themeshock_enablePostTypeServices']) || isset($_POST['themeshock_enablePostTypeProducts']) || isset($_POST['themeshock_enablePostTypeTestimonials']))?$redirect_warr = 'true':$redirect_warr = 'false'; if (is_user_logged_in()){ $wpdb->query(" UPDATE $wpdb->posts SET post_status = '".$wtsStatus."' WHERE post_name = '".$wtsPostName."';" ); $menu_current = get_theme_mod('nav_menu_locations'); if($menu_current['shock_menu'] != 0){ $term_shock_menu = get_term_by('term_id', $menu_current['shock_menu'], 'nav_menu'); $idsPostNameWts = $wpdb->get_results("SELECT ID FROM wp_posts w where post_name like '%wts%' and post_status = 'trash'"); $resultMenuItems = $wpdb->get_results($wpdb->prepare("SElECT post_id, meta_value FROM wp_term_relationships rs, wp_postmeta pm where rs.term_taxonomy_id = %s and rs.object_id = pm.post_id and meta_key = '_menu_item_object_id';", $term_shock_menu->term_taxonomy_id)); foreach($idsPostNameWts as $idPostName){ foreach($resultMenuItems as $resultMenuItem){ if($resultMenuItem->meta_value === $idPostName->ID){ $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %s;", $resultMenuItem->post_id)); $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->posts WHERE id = %s;", $resultMenuItem->post_id)); $wpdb->query($wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE post_id = %s;", $resultMenuItem->post_id)); } } } ($redirect_warr === 'true')?header('Location: '.$_SERVER['REQUEST_URI']):''; } } } function activeCustomPostType($CustomPostType, $wtsPostType, $wtsPostName){ global $wpdb; if(get_option('themeshock_enablePostType'.$CustomPostType) === 'true'): statusCustomPostType($wtsPostName, 'publish'); add_action('init', $wtsPostType); else: statusCustomPostType($wtsPostName, 'trash'); remove_action('init', $wtsPostType); endif; } function is_wpthemegenerator(){ if($_SERVER['HTTP_HOST'] == 'www.wpthemegenerator.com'){ return true; }else{ return false; } } include 'functions/framework-tool-panel.php'; get_template_part('functions/sidebars'); get_template_part('functions/taxonomies'); get_template_part('functions/shortcodes'); get_template_part('functions/widgets'); ?>