$plugin_data){ switch (basename($plugin_file)){ case 'wpts_matrix.php': $gridlayout=true; break; case 'wpts_slider.php'://plugin file name for jqueryslidershock $jqueryslider=true; break; } } if ($gridlayout===false || $jqueryslider===false ): ?>

Please check shocks recommended plugins - Dismiss

$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', 'light_box' ); add_action( 'admin_enqueue_scripts', 'add_slider' );//functions for evertthing dashboard 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 ); if($option_name=='ts_shopping_cart_woo'){ $result124=getThemeGenShoppingCart(true); } break; } } } } if(!empty($result124)){ @header('location: '.admin_url('themes.php?page=theme_options')); // exit; } $theme_page = add_theme_page( __( 'Theme Options', $themename ), // Name of page __( 'Theme Options', $themename ), // Label in menu 'edit_theme_options', // Capability required 'theme_options', // Menu slug, used to uniquely identify the page 'themeshock_admin' // Function that renders the options page ); if ( ! $theme_page ) return; add_action( "load-$theme_page", 'themeshock_help' ); //add_object_page($themename, $themename, 'administrator', basename(__FILE__), 'themeshock_admin'); } /** * [themeshock_help This function hass been created to show the necessary information for the theme] * @return no return */ function themeshock_help(){ /*muestra la ayuda themes options */ global $themename; //General Menu $help=''; //License. $sidebar='
WPThemeGenerator is creative under Enterprise License.'; //Specific menu list $overview = '
Font Style
Select the font what you will be use into your theme.
Logo
You can select between css style logo or an image for your theme. In CSS case you choose your theme effects with the logotype toolbar.
Slider Options
Many features hass been added to the theme. You can choose select more than 30 different styles to show your slider in the theme.
Layout Creator
You can create many sidebar automatically for your different posts types and pages.
Responsive Mode
Enable the responsive mode for your site ( Default: Enable ).
Icon Post
Enable to show the post icons in your site.
Search Menu
Use to enable the menu and search form in your theme. Multiple frames and effects could be used into the theme.'; $screen = get_current_screen(); if ( method_exists( $screen, 'add_help_tab' ) ) { // WordPress 3.3 $screen->add_help_tab( array( 'title' => __( 'Overview', $themename ), 'id' => 'theme-options-help', 'content' => $overview ) ); //sidebar $screen->set_help_sidebar( $sidebar ); } } /** * [themeshock_add_init description] * @return [type] [description] */ function themeshock_add_init() { $file_dir = get_template_directory_uri(); wp_enqueue_style("functions", $file_dir."/functions/functions.css", true, "1.0", "all"); if (is_rtl()){ wp_enqueue_style("tg-rtladmin", $file_dir."/functions/rtl.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)

" placeholder="Use hex, rgb, hsl or color name" title="Please Use hex, rgb, hsl or color name eg(#333, rgb(200, 200, 200), hsl(0, 0%, 20%) or blue)" pattern="(blue|red|orange|aqua|green|white|black|lime|purple|yellow|maroon|fuschia|navy|silver|gray|olive|teal|inherit|Inherit|^(hsl|rgb|#)[a-fA-F0-9\,\(\)%]+)" name="" id=""/>
Headings (Titles)

" name="" maxlength="16" class="fontColorTagHeadings" placeholder="Use hex, rgb, hsl or color name" title="Please Use hex, rgb, hsl or color name eg(#333, rgb(200, 200, 200), hsl(0, 0%, 20%) or blue)" pattern="(blue|red|orange|aqua|green|white|black|lime|purple|yellow|maroon|fuschia|navy|silver|gray|olive|teal|inherit|Inherit|^(hsl|rgb|#)[a-fA-F0-9\,\(\)%]+)" 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"/>
/>
value="true"/>
value="true"/>
value="true"/>
The Following Effects And Styles Are Enabled: Big Slider, Multiple Effects - Full Big Slider, Top Position - Big Poster - Poster - Scale Slider - Horizontal Cube Slider - Vertical Cube Slider - Horizontal Slice Slider.

Active Or Download Slidershock Plugin And Enjoy Exclusive And Preconfigured Sliders For The Themegenerator's Main Slider Area.


> 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', 'appearance_page_theme_options', 'wptg_font_style', 'core'); add_meta_box('wptg-logo', 'Logo', 'get_wptg_logo', 'appearance_page_theme_options', 'wptg_logo', 'core'); add_meta_box('wptg-posts', 'Posts Display Options', 'getThemeGenPosts', 'appearance_page_theme_options', 'wptg_posts', 'core'); add_meta_box('wptg-header_elements', 'Menu and Search', 'getThemeGenHeaderElements', 'appearance_page_theme_options', 'wptg_header_elements', 'core'); add_meta_box('wptg-icon-posts', 'Icon Post', 'getThemeGenIconPost', 'appearance_page_theme_options', 'wptg_icon_posts', 'core'); add_meta_box('wptg-responsive', 'Responsive', 'getThemeGenResponsive', 'appearance_page_theme_options', 'wptg_responsive', 'core'); add_meta_box('wptg-footer-info', 'Footer Info', 'getThemeGenFooterInfo', 'appearance_page_theme_options', 'wptg_footer_info', 'core'); add_meta_box('wptg-slider', 'Slider', 'getThemeGenSlider', 'appearance_page_theme_options', 'wptg_slider', 'core'); add_meta_box('wptg-page-layout', 'Layout Creator', 'getThemeGenPageLayout', 'appearance_page_theme_options', 'wptg_page_layout', 'core'); add_meta_box('wptg-tool-wptg', 'Personalize Menu', 'getThemeGenToolWptg', 'appearance_page_theme_options', 'wptg_tool_wptg', 'core'); ?>

Theme Generator ©

Icons: Iconshock
  • id="li-comment-">
    %s - ', get_comment_author_link()) ?>
    $depth, 'max_depth' => $args['max_depth']))) ?>
    ID); if (!empty($custom["feat_post"])){ $feat_post = $custom["feat_post"][0]; }else{ $feat_post='off'; } ?>
    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; if (empty($post))return; $custom = get_post_custom($post->ID); if (!empty($custom["remove_title_page"])){ $remove_title = $custom["remove_title_page"][0]; }else{ $remove_title='off'; } if (!empty($custom["remove_box_content"])){ $removeBoxContent = $custom["remove_box_content"][0]; }else{ $removeBoxContent ='off'; } ?>
    />
    />
    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 /* Esta funcion es para el volver los widgets liquidos segun cuantos estes activos en un sidebar */ 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 = (empty($the_sidebars[$sidebar_id]))?0: 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/"; if (!is_dir($directory_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(); $img_dimensions=get_option('themeshock_slider_dimensions');//carga las imagenes 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);//imagen original $image = wp_get_image_editor($img_slider_info); if ( is_wp_error( $image ) ) { $GLOBALS['error_folder']='Please install GD 2 In your server'; return false; }else{ $image->save( $slider_info[$index]['path'] ); } $sld_bs_p=$upload_dir['basedir'].'/slider/'; $filename=basename($img_slider_info); /*Hacer reingeniera con respecto a slider_images*/ foreach ($img_dimensions as $img_type => $value){ switch ($img_type){ case 'sld_hd': $slider_info[$index]['img_hd']=$upload_dir['baseurl'].'/slider/hd_'.$filename; $path_dst=$sld_bs_p.'hd_'.$filename; break; case 'sld_normal': $slider_info[$index]['url']=$upload_dir['baseurl'].'/slider/md_'.$filename; $path_dst=$sld_bs_p.'md_'.$filename; break; case 'sld_th': $slider_info[$index]['thumbnail']=$upload_dir['baseurl'].'/slider/th_'.$filename; $path_dst=$sld_bs_p.'th_'.$filename; break; } $image = wp_get_image_editor( $slider_info[$index]['path']); $image->resize( (int)$value['w'], (int)$value['h'],true); $image->save( $path_dst ); } } // update_option('themeshock_slider_dimensions',$sld_dimensions);/// 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); $image = wp_get_image_editor($get_img_logo); $image->save($logo_info['path']); chmod($logo_info['path'],0777); update_option('themeshock_logo',maybe_serialize($logo_info)); return $logo_info; } /* Esta funcion es exlusiva para el servidor, es para mostrar y ocultar elementos y recibe el parametro del elemento que se va afectar */ 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; } } } /* funcion para traer los atributos del logo actual y aplicarlos */ 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'].'; display:block;'; 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(!empty($GLOBALS['arg_text_logo']) && $GLOBALS['arg_text_logo'][4] == "text"){ $img_logo = '

    '.$GLOBALS['arg_text_logo'][0].'

    '; }else{ if($GLOBALS['logo_type'] == 'image'){ $img_logo = '

    '; }else{ $img_logo = '

    '.$GLOBALS['logo_text_options']['logo_text'].'

    '; } } return ''; } /* funciton para quitar los puntos suspensivos del excerpt */ 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; } /* funcion para actualizar el estado de los post type recibe dos parametros el post name, y el estado nuevo */ 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']):''; } } } /* funcion para habilitar o desabilitar las taxonomias (portfolio, services, products.. etc)en el dashboard */ 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; } /* funcion que verifica si el dominio es wpthemegenerator */ function is_wpthemegenerator(){ if($_SERVER['HTTP_HOST'] == 'www.wpthemegenerator.com'){ return true; }else{ return false; } } /* Esta funcion es la forma correcta para el upload de las imagenes del logo y la de los sliders, adicionalemnte es la que sube las imagenes por primera vez del logo y el slider. Los parametos que soportan son 4 (el directorio del archivo, el nombre, los atributos del archivo y uno opcional que es para especificar si se va usar para crear las imagenes por primera vez o en cada subida de la imagen ya sea logo o slider) */ function check_filesystem($directory_file, $file_name, $file_info, $trigger = 'qq-uploader') { define('FS_METHOD', 'direct'); require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); global $wp_filesystem; //check_admin_referer(); $method = 'direct'; if ( ! $method ) return false; if ( ! class_exists("WP_Filesystem_$method") ) { $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method); if ( ! file_exists($abstraction_file) ) return; require_once($abstraction_file); } if ( !defined('FS_CHMOD_DIR') ) define('FS_CHMOD_DIR', 0755 ); if ( !defined('FS_CHMOD_FILE') ) define('FS_CHMOD_FILE', 0644 ); $method = "WP_Filesystem_$method"; $wp_filesystem = new $method($args); switch($trigger){ case 'qq-uploader': $filename = trailingslashit($directory_file).$file_name; $wp_filesystem->put_contents($filename, $file_info, 0777); break; case 'active-theme': $wp_filesystem->put_contents($directory_file, $wp_filesystem->get_contents($file_info), 0777); break; } return true; } /*Carga estilos css de contenido*/ function tgtool_header_style() { ?>