Marcos_Alexandre

functions.php

Oct 28th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 41.06 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. add_action( 'after_setup_theme', 'pmc_Scribbo_theme_setup' );
  6. function pmc_Scribbo_theme_setup() {
  7.     global $pmc_data;
  8.     /*text domain*/
  9.     load_theme_textdomain( 'pmc-themes', get_template_directory() . '/lang' );
  10.     /*woocommerce support*/
  11.     add_theme_support( 'post-formats', array( 'link', 'gallery', 'video' , 'audio') );
  12.     /*feed support*/
  13.     add_theme_support( 'automatic-feed-links' );
  14.     /*post thumb support*/
  15.     add_theme_support( 'post-thumbnails' ); // this enable thumbnails and stuffs
  16.     /*setting thumb size*/
  17.     add_image_size( 'gallery', 185,185, true );
  18.     add_image_size( 'widget', 90,60, true );
  19.     add_image_size( 'postBlock', 370,260, true );
  20.     add_image_size( 'blog', 1180, 550, true );
  21.     add_image_size( 'related', 370,250, true );
  22.  
  23.    
  24.     register_nav_menus(array(
  25.    
  26.             'pmcmainmenu' => 'Main Menu',
  27.             'pmcrespmenu' => 'Responsive Menu',
  28.             'pmcscrollmenu' => 'Scroll Menu'           
  29.     ));
  30.    
  31.        
  32.     register_sidebar(array(
  33.         'id' => 'sidebar',
  34.         'name' => 'Sidebar main',
  35.         'before_widget' => '<div class="widget %2$s">',
  36.         'after_widget' => '</div>',
  37.         'before_title' => '<h3>',
  38.         'after_title' => '</h3><div class="widget-line"></div>'
  39.     ));                
  40.    
  41.  
  42.     register_sidebar(array(
  43.         'id' => 'footer1',
  44.         'name' => 'Footer sidebar 1',
  45.         'before_widget' => '<div class="widget %2$s">',
  46.         'after_widget' => '</div>',
  47.         'before_title' => '<h3>',
  48.         'after_title' => '</h3>'
  49.     ));
  50.    
  51.     register_sidebar(array(
  52.         'id' => 'footer2',
  53.         'name' => 'Footer sidebar 2',
  54.         'before_widget' => '<div class="widget %2$s">',
  55.         'after_widget' => '</div>',
  56.         'before_title' => '<h3>',
  57.         'after_title' => '</h3>'
  58.     ));
  59.    
  60.    
  61.     register_sidebar(array(
  62.         'id' => 'footer3',
  63.         'name' => 'Footer sidebar 3',
  64.         'before_widget' => '<div class="widget %2$s">',
  65.         'after_widget' => '</div>',
  66.         'before_title' => '<h3>',
  67.         'after_title' => '</h3>'
  68.     ));
  69.    
  70.     register_sidebar(array(
  71.         'id' => 'banner-topo1',
  72.         'name' => 'Banner Topo',
  73.         'before_widget' => '<li id="%1$s" class="widget %2$s">',
  74.         'after_widget' => '</li>',
  75.         'before_title' => '<h3>',
  76.         'after_title' => '</h3>'
  77.     ));
  78.     register_sidebar(array(
  79.         'id' => 'banner-bottom',
  80.         'name' => 'Banner Rodapé',
  81.         'before_widget' => '<li id="%1$s" class="widget %2$s">',
  82.         'after_widget' => '</li>',
  83.         'before_title' => '<h3>',
  84.         'after_title' => '</h3>'
  85.     ));
  86.  
  87.  
  88.    
  89.     // Responsive walker menu
  90.     class pmc_Walker_Responsive_Menu extends Walker_Nav_Menu {
  91.        
  92.         function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
  93.             global $wp_query;      
  94.             $item_output = $attributes = $prepend ='';
  95.             $class_names = $value = '';
  96.             $classes = empty( $item->classes ) ? array() : (array) $item->classes;
  97.             $class_names = join( ' ', apply_filters( '', array_filter( $classes ), $item ) );          
  98.             $class_names = ' class="'. esc_attr( $class_names ) . '"';             
  99.             // Create a visual indent in the list if we have a child item.
  100.             $visual_indent = ( $depth ) ? str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-circle"></i>', $depth) : '';
  101.             // Load the item URL
  102.             $attributes .= ! empty( $item->url ) ? ' href="'   . esc_attr( $item->url ) .'"' : '';
  103.             // If we have hierarchy for the item, add the indent, if not, leave it out.
  104.             // Loop through and output each menu item as this.
  105.             if($depth != 0) {
  106.                 $item_output .= '<a '. $class_names . $attributes .'>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-circle"></i>' . $item->title. '</a><br>';
  107.             } else {
  108.                 $item_output .= '<a ' . $class_names . $attributes .'><strong>'.$prepend.$item->title.'</strong></a><br>';
  109.             }
  110.             // Make the output happen.
  111.             $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
  112.         }
  113.     }
  114.    
  115.    
  116.     // Main walker menu
  117.     class pmc_Walker_Main_Menu extends Walker_Nav_Menu
  118.     {      
  119.         function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
  120.            $this->curItem = $item;
  121.            global $wp_query;
  122.            $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
  123.            $class_names = $value = '';
  124.            $classes = empty( $item->classes ) ? array() : (array) $item->classes;
  125.            $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
  126.            $class_names = ' class="'. esc_attr( $class_names ) . '"';
  127.            $image  = ! empty( $item->custom )     ? ' <img src="'.esc_attr($item->custom).'">' : '';
  128.            $output .= $indent . '<li id="menu-item-'.rand(0,9999).'-'. $item->ID . '"' . $value . $class_names .' );">';
  129.            $attributes_title  = ! empty( $item->attr_title ) ? ' <i class="fa '  . esc_attr( $item->attr_title ) .'"></i>' : '';
  130.            $attributes  = ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';
  131.            $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';
  132.            $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';
  133.            $prepend = '';
  134.            $append = '';
  135.            if($depth != 0)
  136.            {
  137.                 $append = $prepend = '';
  138.            }
  139.             $item_output = $args->before;
  140.             $item_output .= '<a '. $attributes .'>';
  141.             $item_output .= $attributes_title.$args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;
  142.             $item_output .= $args->link_after;
  143.             $item_output .= '</a>';
  144.             $item_output .= $args->after;
  145.             $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
  146.         }
  147.     }
  148.  
  149. }
  150.  
  151.  
  152.  
  153.  
  154. /*-----------------------------------------------------------------------------------*/
  155. // Options Framework
  156. /*-----------------------------------------------------------------------------------*/
  157. // Paths to admin functions
  158. define('MY_TEXTDOMAIN', 'pmc-themes');
  159. define('ADMIN_PATH', get_stylesheet_directory() . '/admin/');
  160. define('BOX_PATH', get_stylesheet_directory() . '/includes/boxes/');
  161. define('ADMIN_DIR', get_template_directory_uri() . '/admin/');
  162. define('LAYOUT_PATH', ADMIN_PATH . '/layouts/');
  163. // You can mess with these 2 if you wish.
  164. $themedata = wp_get_theme(get_stylesheet_directory() . '/style.css');
  165. define('THEMENAME', $themedata['Name']);
  166. define('OPTIONS', 'of_options_pmc'); // Name of the database row where your options are stored
  167. if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
  168.     //Call action that sets
  169.     add_action('admin_head','pmc_options');
  170. }
  171. /* import theme options */
  172. function pmc_options()  {
  173.        
  174.     if (!get_option('of_options_pmc')){
  175.    
  176.         $pmc_data = 'YTo1Nzp7czoxNDoic2hvd3Jlc3BvbnNpdmUiO3M6MToiMSI7czoxMDoidXNlX2Jsb2NrMSI7czoxOiIxIjtzOjEwOiJ1c2VfYmxvY2szIjtzOjE6IjEiO3M6MTA6InVzZV9ibG9jazIiO3M6MToiMSI7czoxMzoidXNlX2Z1bGx3aWR0aCI7czoxOiIxIjtzOjQ6ImxvZ28iO3M6NzU6Imh0dHA6Ly9zY3JpYmJvLnByZW1pdW1jb2RpbmcuY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDE0LzEyL3Njcmliby1sb2dvLnBuZyI7czoxMToibG9nb19yZXRpbmEiO3M6Nzg6Imh0dHA6Ly9zY3JpYmJvLnByZW1pdW1jb2RpbmcuY29tL3dwLWNvbnRlbnQvdXBsb2Fkcy8yMDE0LzEyL3Njcmliby1sb2dvQDJ4LnBuZyI7czoxMToic2Nyb2xsX2xvZ28iO3M6NzU6Imh0dHA6Ly9zY3JpYmJvL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wqkgMjAxMyBjb3B5cmlnaHQgUFJFTUlVTUNPRElORyAvLyBBbGwgcmlnaHRzIHJlc2VydmVkPC9kaXY+DQoNCjxkaXYgY2xhc3MgPVwicmlnaHQtZm9vdGVyLWNvbnRlbnRcIj5TY3JpYmJvIHdhcyBtYWRlIHdpdGggbG92ZSBieSBQcmVtaXVtY29kaW5nPC9kaXY+DQoiO3M6OToidXNlX2JveGVkIjtzOjA6IiI7fQ==';
  177.         $pmc_data = unserialize(base64_decode($pmc_data)); //100% safe - ignore theme check nag
  178.         update_option('of_options_pmc', $pmc_data);
  179.        
  180.     }
  181.     //delete_option(OPTIONS);
  182.    
  183. }
  184. // Build Options
  185. include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
  186. $root =  get_template_directory() .'/';
  187. $admin =  get_template_directory() . '/admin/';
  188. require_once ($admin . 'theme-options.php');   // Options panel settings and custom settings
  189. require_once ($admin . 'admin-interface.php');  // Admin Interfaces
  190. require_once ($admin . 'admin-functions.php');  // Theme actions based on options settings
  191. $includes =  get_template_directory() . '/includes/';
  192. $widget_includes =  get_template_directory() . '/includes/widgets/';
  193. /* include custom widgets */
  194. require_once ($widget_includes . 'recent_post_widget.php');
  195. require_once ($widget_includes . 'popular_post_widget.php');
  196. require_once ($widget_includes . 'social_widget.php');
  197. /* include scripts */
  198. function pmc_scripts() {
  199.     global $pmc_data;
  200.     /*scripts*/
  201.     wp_enqueue_script('pmc_fitvideos', get_template_directory_uri() . '/js/jquery.fitvids.js', array('jquery'),true,true); 
  202.     wp_enqueue_script('pmc_scrollto', get_template_directory_uri() . '/js/jquery.scrollTo.js', array('jquery'),true,true); 
  203.     wp_enqueue_script('pmc_retinaimages', get_template_directory_uri() . '/js/retina.min.js', array('jquery'),true,true);  
  204.     wp_enqueue_script('pmc_customjs', get_template_directory_uri() . '/js/custom.js', array('jquery'),true,true);        
  205.     wp_enqueue_script('pmc_prettyphoto_n', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array('jquery'),true,true);
  206.     wp_enqueue_script('pmc_bxSlider', get_template_directory_uri() . '/js/jquery.bxslider.js', array('jquery') ,true,true);    
  207.     wp_enqueue_script('pmc_easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', array('jquery'),true,true); 
  208.     /*style*/
  209.     wp_enqueue_style( 'main', get_stylesheet_uri(), 'style');
  210.     wp_enqueue_style( 'prettyp', get_template_directory_uri() . '/css/prettyPhoto.css', 'style');
  211.     /*style*/
  212.     wp_enqueue_style( 'main', get_stylesheet_uri(), 'style');
  213.     if(isset($pmc_data['body_font'])){         
  214.         if(($pmc_data['body_font']['face'] != 'verdana') and ($pmc_data['body_font']['face'] != 'trebuchet') and
  215.             ($pmc_data['body_font']['face'] != 'georgia') and ($pmc_data['body_font']['face'] != 'Helvetica Neue') and
  216.             ($pmc_data['body_font']['face'] != 'times,tahoma') and ($pmc_data['body_font']['face'] != 'arial')) {  
  217.                 if(isset($pmc_data['google_body_custom']) && $pmc_data['google_body_custom'] != ''){
  218.                     $font_explode = explode(' ' , $pmc_data['google_body_custom']);
  219.                     $font_body  = '';
  220.                     $size = count($font_explode);
  221.                     $count = 0;
  222.                     if(count($font_explode) > 0){
  223.                         foreach($font_explode as $font){
  224.                             if($count < $size-1){
  225.                                 $font_body .= $font_explode[$count].'+';
  226.                             }
  227.                             else{
  228.                                 $font_body .= $font_explode[$count];
  229.                             }
  230.                             $count++;
  231.                         }
  232.                     }else{
  233.                         $font_body = $pmc_data['google_body_custom'];
  234.                     }
  235.                 }else{
  236.                     $font_body = $pmc_data['body_font']['face'];
  237.                 }          
  238.                 wp_enqueue_style('googleFontbody', 'http://fonts.googleapis.com/css?family='.$font_body ,'',NULL);         
  239.         }                      
  240.     }      
  241.     if(isset($pmc_data['heading_font'])){          
  242.         if(($pmc_data['heading_font']['face'] != 'verdana') and ($pmc_data['heading_font']['face'] != 'trebuchet') and
  243.             ($pmc_data['heading_font']['face'] != 'georgia') and ($pmc_data['heading_font']['face'] != 'Helvetica Neue') and
  244.             ($pmc_data['heading_font']['face'] != 'times,tahoma') and ($pmc_data['heading_font']['face'] != 'arial')) {
  245.                 if(isset($pmc_data['google_heading_custom']) && $pmc_data['google_heading_custom'] != ''){
  246.                     $font_explode = explode(' ' , $pmc_data['google_heading_custom']);
  247.                     $font_heading  = '';
  248.                     $size = count($font_explode);
  249.                     $count = 0;
  250.                     if(count($font_explode) > 0){
  251.                         foreach($font_explode as $font){
  252.                             if($count < $size-1){
  253.                                 $font_heading .= $font_explode[$count].'+';
  254.                             }
  255.                             else{
  256.                                 $font_heading .= $font_explode[$count];
  257.                             }
  258.                             $count++;
  259.                         }
  260.                     }else{
  261.                         $font_heading = $pmc_data['google_heading_custom'];
  262.                     }
  263.                 }else{
  264.                     $font_heading = $pmc_data['heading_font']['face'];
  265.                 }
  266.        
  267.                 wp_enqueue_style('googleFontHeading', 'http://fonts.googleapis.com/css?family='.$font_heading ,'',NULL);           
  268.         }                      
  269.     }
  270.     if(isset($pmc_data['menu_font']['face'])){         
  271.         if(($pmc_data['menu_font']['face'] != 'verdana') and ($pmc_data['menu_font']['face'] != 'trebuchet') and
  272.             ($pmc_data['menu_font']['face']!= 'georgia') and ($pmc_data['menu_font']['face'] != 'Helvetica Neue') and
  273.             ($pmc_data['menu_font']['face'] != 'times,tahoma') and ($pmc_data['menu_font']['face'] != 'arial')) {  
  274.                 if(isset($pmc_data['google_menu_custom']) && $pmc_data['google_menu_custom'] != ''){
  275.                     $font_explode = explode(' ' , $pmc_data['google_menu_custom']);
  276.                     $font_menu  = '';
  277.                     $size = count($font_explode);
  278.                     $count = 0;
  279.                     if(count($font_explode) > 0){
  280.                         foreach($font_explode as $font){
  281.                             if($count < $size-1){
  282.                                 $font_menu .= $font_explode[$count].'+';
  283.                             }
  284.                             else{
  285.                                 $font_menu .= $font_explode[$count];
  286.                             }
  287.                             $count++;
  288.                         }
  289.                     }else{
  290.                         $font_menu = $pmc_data['google_menu_custom'];
  291.                     }
  292.                 }else{
  293.                     $font_menu = $pmc_data['menu_font']['face'];
  294.                 }              
  295.                 wp_enqueue_style('googleFontMenu', 'http://fonts.googleapis.com/css?family='.$font_menu ,'',NULL);         
  296.         }                      
  297.     }  
  298.  
  299.     wp_enqueue_style('options',  get_stylesheet_directory_uri() . '/css/options.css', 'style');            
  300. }
  301. add_action( 'wp_enqueue_scripts', 'pmc_scripts' );
  302.  
  303. /*shorcode to excerpt*/
  304. remove_filter( 'get_the_excerpt', 'wp_trim_excerpt'  ); //Remove the filter we don't want
  305. add_filter( 'get_the_excerpt', 'pmc_wp_trim_excerpt' ); //Add the modified filter
  306. add_filter( 'the_excerpt', 'do_shortcode' ); //Make sure shortcodes get processed
  307.  
  308. function pmc_wp_trim_excerpt($text = '') {
  309.     $raw_excerpt = $text;
  310.     if ( '' == $text ) {
  311.         $text = get_the_content('');
  312.         //$text = strip_shortcodes( $text ); //Comment out the part we don't want
  313.         $text = apply_filters('the_content', $text);
  314.         $text = str_replace(']]>', ']]&gt;', $text);
  315.         $excerpt_length = apply_filters('excerpt_length', 55);
  316.         $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
  317.         $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
  318.     }
  319.     return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
  320. }
  321.  
  322. /*add boxed to body class*/
  323.  
  324. add_filter('body_class','pmc_body_class');
  325.  
  326. function pmc_body_class($classes) {
  327.     global $pmc_data;
  328.     $class = '';
  329.     if(isset($pmc_data['use_boxed'])){
  330.         $classes[] = 'pmc_boxed';
  331.     }
  332.     return $classes;
  333. }
  334.  
  335. /* custom breadcrumb */
  336. function pmc_breadcrumb($title = false) {
  337.     global $pmc_data;
  338.     $breadcrumb = '';
  339.     if (!is_home()) {
  340.         if($title == false){
  341.             $breadcrumb .= '<a href="';
  342.             $breadcrumb .=  home_url();
  343.             $breadcrumb .=  '">';
  344.             $breadcrumb .= __('Home', 'pmc-themes');
  345.             $breadcrumb .=  "</a> &#187; ";
  346.         }
  347.         if (is_single()) {
  348.             if (is_single()) {
  349.                 $name = '';
  350.                 if(!get_query_var($pmc_data['port_slug']) && !get_query_var('product')){
  351.                     $category = get_the_category(); +
  352.                     $category_id = get_cat_ID($category[0]->cat_name);
  353.                     $category_link = get_category_link($category_id);                  
  354.                     $name = '<a href="'. esc_url( $category_link ).'">'.$category[0]->cat_name .'</a>';
  355.                 }
  356.                 else{
  357.                     $taxonomy = 'portfoliocategory';
  358.                     $entrycategory = get_the_term_list( get_the_ID(), $taxonomy, '', ',', '' );
  359.                     $catstring = $entrycategory;
  360.                     $catidlist = explode(",", $catstring); 
  361.                     $name = $catidlist[0];
  362.                 }
  363.                 if($title == false){
  364.                     $breadcrumb .= $name .' &#187; <span>'. get_the_title().'</span>';
  365.                 }
  366.                 else{
  367.                     $breadcrumb .= get_the_title();
  368.                 }
  369.             }  
  370.         } elseif (is_page()) {
  371.             $breadcrumb .=  '<span>'.get_the_title().'</span>';
  372.         }
  373.         elseif(get_query_var('portfoliocategory')){
  374.             $term = get_term_by('slug', get_query_var('portfoliocategory'), 'portfoliocategory'); $name = $term->name;
  375.             $breadcrumb .=  '<span>'.$name.'</span>';
  376.         }  
  377.         else if(is_tag()){
  378.             $tag = get_query_var('tag');
  379.             $tag = str_replace('-',' ',$tag);
  380.             $breadcrumb .=  '<span>'.$tag.'</span>';
  381.         }
  382.         else if(is_search()){
  383.             $breadcrumb .= __('Search results for ', 'pmc-themes') .'"<span>'.get_search_query().'</span>"';           
  384.         }
  385.         else if(is_category()){
  386.             $cat = get_query_var('cat');
  387.             $cat = get_category($cat);
  388.             $breadcrumb .=  '<span>'.$cat->name.'</span>';
  389.         }
  390.         else if(is_archive()){
  391.             $breadcrumb .=  '<span>'.__('Archive','pmc-themes').'</span>';
  392.         }  
  393.         else{
  394.             $breadcrumb .=  'Home';
  395.         }
  396.  
  397.     }
  398.     return $breadcrumb ;
  399. }
  400. /* social share links */
  401. function pmc_socialLinkSingle($link,$title) {
  402.     $social = '';
  403.     $social  .= '<div class="addthis_toolbox">';
  404.     $social .= '<div class="custom_images">';
  405.     $social .= '<a class="addthis_button_instagram" addthis:url="'.esc_url($link).'" addthis:title="'.esc_attr($title).'"><i class="fa fa-instagram"></i></a>';
  406.     $social .= '<a class="addthis_button_facebook" addthis:url="'.esc_url($link).'" addthis:title="'.esc_attr($title).'" ><i class="fa fa-facebook"></i></a>';
  407.     // $social .= '<a class="addthis_button_twitter" addthis:url="'.esc_url($link).'" addthis:title="'.esc_attr($title).'"><i class="fa fa-twitter"></i></a>';  
  408.     $social .= '<a class="addthis_button_pinterest_share" addthis:url="'.esc_url($link).'" addthis:title="'.esc_attr($title).'"><i class="fa fa-pinterest"></i></a>';
  409.     //$social .= '<a class="addthis_button_google" addthis:url="'.esc_url($link).'" g:plusone:count="false" addthis:title="'.esc_attr($title).'"></a>';    
  410.     $social .='</div><script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js"></script>';   
  411.     $social .= '</div>';
  412.     echo $social;
  413.    
  414.    
  415. }
  416. /* links to social profile */
  417. function pmc_socialLink() {
  418.     $social = '';
  419.     global $pmc_data;
  420.     $icons = $pmc_data['socialicons'];
  421.     foreach ($icons as $icon){
  422.         $social .= '<a target="_blank"  href="'.esc_url($icon['link']).'" title="'.esc_attr($icon['title']).'"><img src = "'.esc_url($icon['url']).'" alt="'.esc_attr($icon['title']).'"></a>';
  423.     }
  424.     echo $social;
  425. }
  426.  
  427. add_filter('the_content', 'pmc_addlightbox');
  428. /* add lightbox to images*/
  429. function pmc_addlightbox($content)
  430. {   global $post;
  431.     $pattern = "/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";
  432.     $replacement = '<a$1href=$2$3.$4$5 rel="lightbox[%LIGHTID%]"$6>';
  433.     $content = preg_replace($pattern, $replacement, $content);
  434.     if(isset($post->ID))
  435.         $content = str_replace("%LIGHTID%", $post->ID, $content);
  436.     return $content;
  437. }
  438. /* remove double // char */
  439. function pmc_stripText($string)
  440. {
  441.     return str_replace("\\",'',$string);
  442. }
  443.    
  444. /* custom post types */
  445. add_action('save_post', 'pmc_update_post_type');
  446. add_action("admin_init", "pmc_add_meta_box");
  447.  
  448. function pmc_add_meta_box(){
  449.     add_meta_box("pmc_post_type", "Post type", "pmc_post_type", "post", "normal", "high");     
  450. }  
  451.  
  452. function pmc_post_type(){
  453.     global $post;
  454.     $pmc_data = get_post_custom(get_the_id());
  455.  
  456.     if (isset($pmc_data["video_post_url"][0])){
  457.         $video_post_url = $pmc_data["video_post_url"][0];
  458.     }else{
  459.         $video_post_url = "";
  460.     }  
  461.    
  462.     if (isset($pmc_data["link_post_url"][0])){
  463.         $link_post_url = $pmc_data["link_post_url"][0];
  464.     }else{
  465.         $link_post_url = "";
  466.     }  
  467.    
  468.     if (isset($pmc_data["audio_post_url"][0])){
  469.         $audio_post_url = $pmc_data["audio_post_url"][0];
  470.     }else{
  471.         $audio_post_url = "";
  472.     }  
  473.     if (isset($pmc_data["audio_post_title"][0])){
  474.         $audio_post_title = $pmc_data["audio_post_title"][0];
  475.     }else{
  476.         $audio_post_title = "";
  477.     }  
  478. ?>
  479.     <div id="portfolio-category-options">
  480.         <table cellpadding="15" cellspacing="15">
  481.             <tr class="videoonly" style="border-bottom:1px solid #000;">
  482.                 <td><label>Video URL(*required) - add if you select video post: <i style="color: #999999;"></i></label><br><input name="video_post_url" value="<?php echo esc_attr($video_post_url); ?>" /> </td>  
  483.             </tr>      
  484.             <tr class="linkonly" >
  485.                 <td><label>Link URL - add if you select link post : <i style="color: #999999;"></i></label><br><input name="link_post_url"  value="<?php echo esc_attr($link_post_url); ?>" /></td>
  486.             </tr>              
  487.             <tr class="audioonly">
  488.                 <td><label>Audio URL - add if you select audio post: <i style="color: #999999;"></i></label><br><input name="audio_post_url"  value="<?php echo esc_attr($audio_post_url); ?>" /></td>
  489.             </tr>
  490.             <tr class="audioonly">
  491.                 <td><label>Audio title - add if you select audio post: <i style="color: #999999;"></i></label><br><input name="audio_post_title"  value="<?php echo esc_attr($audio_post_title); ?>" /></td>
  492.             </tr>      
  493.             <tr class="nooptions">
  494.                 <td>No options for this post type.</td>
  495.             </tr>              
  496.         </table>
  497.     </div>
  498.     <style>
  499.     #portfolio-category-options td {width:50%}
  500.     #portfolio-category-options input {width:100%}
  501.     </style>
  502.     <script>
  503.     jQuery(document).ready(function(){ 
  504.             if (jQuery("input[name=post_format]:checked").val() == 'video'){
  505.                 jQuery('.videoonly').show();
  506.                 jQuery('.audioonly, .linkonly , .nooptions').hide();}
  507.                
  508.             else if (jQuery("input[name=post_format]:checked").val() == 'link'){
  509.                 jQuery('.linkonly').show();
  510.                 jQuery('.videoonly, .select_video,.nooptions').hide();  }  
  511.                
  512.             else if (jQuery("input[name=post_format]:checked").val() == 'audio'){
  513.                 jQuery('.videoonly, .linkonly,.nooptions').hide(); 
  514.                 jQuery('.audioonly').show();}                      
  515.             else{
  516.                 jQuery('.videoonly').hide();
  517.                 jQuery('.audioonly').hide();
  518.                 jQuery('.linkonly').hide();
  519.                 jQuery('.nooptions').show();}  
  520.            
  521.             jQuery("input[name=post_format]").change(function(){
  522.             if (jQuery("input[name=post_format]:checked").val() == 'video'){
  523.                 jQuery('.videoonly').show();
  524.                 jQuery('.audioonly, .linkonly,.nooptions').hide();}
  525.                
  526.             else if (jQuery("input[name=post_format]:checked").val() == 'link'){
  527.                 jQuery('.linkonly').show();
  528.                 jQuery('.videoonly, .audioonly,.nooptions').hide(); }  
  529.                
  530.             else if (jQuery("input[name=post_format]:checked").val() == 'audio'){
  531.                 jQuery('.videoonly, .linkonly,.nooptions').hide(); 
  532.                 jQuery('.audioonly').show();}  
  533.                
  534.             else{
  535.                 jQuery('.videoonly').hide();
  536.                 jQuery('.audioonly').hide();
  537.                 jQuery('.linkonly').hide();
  538.                 jQuery('.nooptions').show();}              
  539.         });
  540.     });
  541.     </script>  
  542.      
  543. <?php
  544.    
  545. }
  546. function pmc_update_post_type(){
  547.     global $post;
  548.     if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
  549.         return $post_id;
  550.     }
  551.     if($post){
  552.  
  553.         if( isset($_POST["video_post_url"]) ) {
  554.             update_post_meta($post->ID, "video_post_url", $_POST["video_post_url"]);
  555.         }      
  556.         if( isset($_POST["link_post_url"]) ) {
  557.             update_post_meta($post->ID, "link_post_url", $_POST["link_post_url"]);
  558.         }  
  559.         if( isset($_POST["audio_post_url"]) ) {
  560.             update_post_meta($post->ID, "audio_post_url", $_POST["audio_post_url"]);
  561.         }      
  562.         if( isset($_POST["audio_post_title"]) ) {
  563.             update_post_meta($post->ID, "audio_post_title", $_POST["audio_post_title"]);
  564.         }                  
  565.            
  566.     }
  567.    
  568.    
  569.    
  570. }
  571. if( !function_exists( 'Scribbo_fallback_menu' ) )
  572. {
  573.  
  574.     function Scribbo_fallback_menu()
  575.     {
  576.         $current = "";
  577.         if (is_front_page()){$current = "class='current-menu-item'";}
  578.         echo "<div class='fallback_menu'>";
  579.         echo "<ul class='Scribbo_fallback menu'>";
  580.         echo "<li $current><a href='".esc_url(home_url())."'>Home</a></li>";
  581.         wp_list_pages('title_li=&sort_column=menu_order');
  582.         echo "</ul></div>";
  583.     }
  584. }
  585.  
  586. add_filter( 'the_category', 'pmc_add_nofollow_cat' );  
  587.  
  588. function pmc_add_nofollow_cat( $text ) {
  589.     $text = str_replace('rel="category tag"', "", $text);
  590.     return $text;
  591. }
  592.  
  593. /* get image from post */
  594. function pmc_getImage($id, $image){
  595.     $return = '';
  596.     if ( has_post_thumbnail() ){
  597.         $return = get_the_post_thumbnail($id,$image);
  598.         }
  599.     else
  600.         $return = '';
  601.    
  602.     return  $return;
  603. }
  604.  
  605. if ( ! isset( $content_width ) ) $content_width = 800;
  606.  
  607.  
  608. function pmc_excerpt_more( $more ) {
  609.     return ' ...';
  610. }
  611. add_filter('excerpt_more', 'pmc_excerpt_more');
  612.  
  613. /*import plugins*/
  614.  
  615. function pmc_add_this_script_footer(){
  616.     global $pmc_data;
  617.  
  618.  
  619. ?>
  620. <script>   
  621.     jQuery(document).ready(function(){ 
  622.         jQuery('.searchform #s').attr('value','<?php _e('','pmc-themes'); ?>');
  623.        
  624.         jQuery('.searchform #s').focus(function() {
  625.             jQuery('.searchform #s').val('');
  626.         });
  627.        
  628.         jQuery('.searchform #s').focusout(function() {
  629.             if(jQuery('.searchform #s').attr('value') == '')
  630.                 jQuery('.searchform #s').attr('value','<?php _e('','pmc-themes'); ?>');
  631.         });
  632.         jQuery("a[rel^='lightbox']").prettyPhoto({theme:'light_rounded',show_title: true, deeplinking:false,callback:function(){scroll_menu()}});      
  633.     }); </script>
  634.  
  635. <?php  }
  636.  
  637.  
  638. add_action('wp_footer', 'pmc_add_this_script_footer');
  639.  
  640.  
  641.  
  642. //Chamando OWL Carousel
  643. add_action('wp_enqueue_scripts', 'enqueue_owl');
  644. function enqueue_owl(){
  645.  
  646.   wp_enqueue_script('owl', get_template_directory_uri().'/js/owl-carousel/owl.carousel.js', array('jquery'));
  647.  
  648. }
  649. //Ativando OWL Carousel Calendar
  650. add_action('wp_footer', 'activate_owl');
  651. function activate_owl(){
  652. ?>
  653.  
  654. <script type="text/javascript">
  655.   jQuery(document).ready(function() {
  656.     jQuery(".owl_carousel").owlCarousel({
  657.       autoPlay: 3000, //Set AutoPlay to 3 seconds
  658.       items : 4,
  659.       itemsDesktop : [1199,4],
  660.       itemsDesktopSmall : [979,4],
  661.       itemsTablet: [768,3],
  662.       itemsMobile : [750,1],
  663.       pagination : true,
  664.       paginationNumbers: false
  665.     });
  666.   });
  667. </script>
  668.  
  669. <?php
  670.  }
  671.  
  672. add_action('init', 'type_post_team');
  673.  
  674. function type_post_team() {
  675.     $labels = array(
  676.         'name' => _x('Team', 'post type general name'),
  677.         'singular_name' => _x('Team', 'post type singular name'),
  678.         'add_new' => 'Novo Cadastro',
  679.         'all_items' => 'Todos os Cadastros',
  680.         'add_new_item' => 'Adicionar Novo Cadastro',
  681.         'edit_item' => 'Editar Cadastro',
  682.         'new_item' => 'Novo Cadastro',
  683.         'view_item' => 'Visualizar Cadastro',
  684.         'search_items' => 'Buscar Cadastro',
  685.         'not_found' =>  'Nenhum Cadastro encontrado',
  686.         'not_found_in_trash' => 'Nenhum Cadastro encontrado na lixeira',
  687.         'menu_name' => 'Team'
  688.     );
  689.  
  690.     $args = array(
  691.         'labels'        => $labels,
  692.         'public'        => true,
  693.         'menu_position' => 5,
  694.         //'register_meta_box_cb' => 'servicos_meta_box',
  695.         'supports' => array('title','thumbnail','editor','custom-fields', 'page-attributes', 'post-formats', 'trackbacks'),
  696.         'taxonomies' => array('post_tag')
  697.       );
  698.  
  699. register_post_type( 'team' , $args );
  700.  
  701.  
  702. /*register_taxonomy("categorias", array("consultores"), array(
  703.     "hierarchical" => true,
  704.     "label" => "Categorias",
  705.     "singular_label" =>
  706.     "Categoria",
  707.     // "rewrite" => true
  708.     "rewrite" => array(    
  709.         // 'with_front' => false,      
  710.         'hierarchical' => true
  711.     )
  712.  
  713. ));*/
  714.  
  715. flush_rewrite_rules();
  716. }
  717.  
  718. add_action('init', 'type_post_press');
  719.  
  720. function type_post_press() {
  721.     $labels = array(
  722.         'name' => _x('Press', 'post type general name'),
  723.         'singular_name' => _x('Press', 'post type singular name'),
  724.         'add_new' => 'Novo Cadastro',
  725.         'all_items' => 'Todos os Cadastros',
  726.         'add_new_item' => 'Adicionar Novo Cadastro',
  727.         'edit_item' => 'Editar Cadastro',
  728.         'new_item' => 'Novo Cadastro',
  729.         'view_item' => 'Visualizar Cadastro',
  730.         'search_items' => 'Buscar Cadastro',
  731.         'not_found' =>  'Nenhum Cadastro encontrado',
  732.         'not_found_in_trash' => 'Nenhum Cadastro encontrado na lixeira',
  733.         'menu_name' => 'Press'
  734.     );
  735.  
  736.     $args = array(
  737.         'labels'        => $labels,
  738.         'public'        => true,
  739.         'menu_position' => 5,
  740.         //'register_meta_box_cb' => 'servicos_meta_box',
  741.         'supports' => array('title','thumbnail','editor','custom-fields', 'page-attributes', 'post-formats', 'trackbacks'),
  742.         //'taxonomies' => array('post_tag')
  743.       );
  744.  
  745. register_post_type( 'press' , $args );
  746.  
  747.  
  748. /*register_taxonomy("categorias", array("consultores"), array(
  749.     "hierarchical" => true,
  750.     "label" => "Categorias",
  751.     "singular_label" =>
  752.     "Categoria",
  753.     // "rewrite" => true
  754.     "rewrite" => array(    
  755.         // 'with_front' => false,      
  756.         'hierarchical' => true
  757.     )
  758.  
  759. ));*/
  760.  
  761. flush_rewrite_rules();
  762. }
  763.  
  764. add_action('init', 'type_post_gastronomia');
  765.  
  766. function type_post_gastronomia() {
  767.     $labels = array(
  768.         'name' => _x('Gastronomia', 'post type general name'),
  769.         'singular_name' => _x('Gastronomia', 'post type singular name'),
  770.         'add_new' => 'Novo Cadastro',
  771.         'all_items' => 'Todos os Cadastros',
  772.         'add_new_item' => 'Adicionar Novo Cadastro',
  773.         'edit_item' => 'Editar Cadastro',
  774.         'new_item' => 'Novo Cadastro',
  775.         'view_item' => 'Visualizar Cadastro',
  776.         'search_items' => 'Buscar Cadastro',
  777.         'not_found' =>  'Nenhum Cadastro encontrado',
  778.         'not_found_in_trash' => 'Nenhum Cadastro encontrado na lixeira',
  779.         'menu_name' => 'Gastronomia'
  780.     );
  781.  
  782.     $args = array(
  783.         'labels'        => $labels,
  784.         'public'        => true,
  785.         'menu_position' => 5,
  786.         //'register_meta_box_cb' => 'servicos_meta_box',
  787.         'supports' => array('title','thumbnail','editor','custom-fields', 'page-attributes', 'post-formats', 'trackbacks','excerpt'),
  788.         'taxonomies' => array('post_tag')
  789.       );
  790.  
  791. register_post_type( 'gastronomia' , $args );
  792.  
  793.  
  794. register_taxonomy("tax_gastronomia", array("gastronomia"), array(
  795.     "hierarchical" => true,
  796.     "label" => "Categorias",
  797.     "singular_label" =>
  798.     "Categoria",
  799.     // "rewrite" => true
  800.     "rewrite" => array(    
  801.         // 'with_front' => false,      
  802.         'hierarchical' => true
  803.     )
  804.  
  805. ));
  806.  
  807. flush_rewrite_rules();
  808. }
  809.  
  810. add_action('init', 'type_post_lifestyle');
  811.  
  812. function type_post_lifestyle() {
  813.     $labels = array(
  814.         'name' => _x('Lifestyle', 'post type general name'),
  815.         'singular_name' => _x('Lifestyle', 'post type singular name'),
  816.         'add_new' => 'Novo Cadastro',
  817.         'all_items' => 'Todos os Cadastros',
  818.         'add_new_item' => 'Adicionar Novo Cadastro',
  819.         'edit_item' => 'Editar Cadastro',
  820.         'new_item' => 'Novo Cadastro',
  821.         'view_item' => 'Visualizar Cadastro',
  822.         'search_items' => 'Buscar Cadastro',
  823.         'not_found' =>  'Nenhum Cadastro encontrado',
  824.         'not_found_in_trash' => 'Nenhum Cadastro encontrado na lixeira',
  825.         'menu_name' => 'Lifestyle'
  826.     );
  827.  
  828.     $args = array(
  829.         'labels'        => $labels,
  830.         'public'        => true,
  831.         'menu_position' => 5,
  832.         //'register_meta_box_cb' => 'servicos_meta_box',
  833.         'supports' => array('title','thumbnail','editor','custom-fields', 'page-attributes', 'post-formats', 'trackbacks','excerpt'),
  834.         'taxonomies' => array('post_tag')
  835.       );
  836.  
  837. register_post_type( 'lifestyle' , $args );
  838.  
  839.  
  840. register_taxonomy("tax_lifestyle", array("lifestyle"), array(
  841.     "hierarchical" => true,
  842.     "label" => "Categorias",
  843.     "singular_label" =>
  844.     "Categoria",
  845.     // "rewrite" => true
  846.     "rewrite" => array(    
  847.         // 'with_front' => false,      
  848.         'hierarchical' => true
  849.     )
  850.  
  851. ));
  852.  
  853. flush_rewrite_rules();
  854. }
  855.  
  856. add_action('init', 'type_post_entretenimento');
  857.  
  858. function type_post_entretenimento() {
  859.     $labels = array(
  860.         'name' => _x('Entretenimento', 'post type general name'),
  861.         'singular_name' => _x('Entretenimento', 'post type singular name'),
  862.         'add_new' => 'Novo Cadastro',
  863.         'all_items' => 'Todos os Cadastros',
  864.         'add_new_item' => 'Adicionar Novo Cadastro',
  865.         'edit_item' => 'Editar Cadastro',
  866.         'new_item' => 'Novo Cadastro',
  867.         'view_item' => 'Visualizar Cadastro',
  868.         'search_items' => 'Buscar Cadastro',
  869.         'not_found' =>  'Nenhum Cadastro encontrado',
  870.         'not_found_in_trash' => 'Nenhum Cadastro encontrado na lixeira',
  871.         'menu_name' => 'Entretenimento'
  872.     );
  873.  
  874.     $args = array(
  875.         'labels'        => $labels,
  876.         'public'        => true,
  877.         'menu_position' => 5,
  878.         //'register_meta_box_cb' => 'servicos_meta_box',
  879.         'supports' => array('title','thumbnail','editor','custom-fields', 'page-attributes', 'post-formats', 'trackbacks','excerpt'),
  880.         'taxonomies' => array('post_tag')
  881.       );
  882.  
  883. register_post_type( 'entretenimento' , $args );
  884.  
  885.  
  886. register_taxonomy("tax_entretenimento", array("entretenimento"), array(
  887.     "hierarchical" => true,
  888.     "label" => "Categorias",
  889.     "singular_label" =>
  890.     "Categoria",
  891.     // "rewrite" => true
  892.     "rewrite" => array(    
  893.         // 'with_front' => false,      
  894.         'hierarchical' => true
  895.     )
  896.  
  897. ));
  898.  
  899. flush_rewrite_rules();
  900. }
  901.  
  902. //custom single
  903. add_filter('single_template', 'check_for_category_single_template');
  904. function check_for_category_single_template( $t ){
  905.  
  906.   foreach( (array) get_the_category() as $cat ){
  907.     if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") ) return TEMPLATEPATH . "/single-{$cat->slug}.php";
  908.     if($cat->parent){
  909.         $cat = get_the_category_by_ID( $cat->parent );
  910.         if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") ) return TEMPLATEPATH . "/single-{$cat->slug}.php";
  911.     }
  912.  
  913.   }
  914.  
  915.   return $t;
  916. }
  917.  
  918. //Chamando Fancyapps
  919. add_action('wp_enqueue_scripts', 'enqueue_fancyapps');
  920. function enqueue_fancyapps(){
  921.  
  922.       //if( is_home() || is_single() || is_page('A Empresa') )
  923.             wp_enqueue_script('fancyapps', get_template_directory_uri().'/js/fancybox/source/jquery.fancybox.pack.js', array('jquery'));
  924.  
  925. }
  926.  
  927. //Ativando Fancyapps iFrame
  928. add_action('wp_head', 'activate_fancyapps_iframe');
  929. function activate_fancyapps_iframe(){
  930.    //if( is_page('Time') ) {
  931. ?>
  932.  
  933. <script type="text/javascript">
  934.   jQuery(document).ready(function() {
  935.     jQuery(".fancybox").fancybox({
  936.         type : 'iframe',
  937.         width: 700,
  938.         height: 500
  939.     });
  940.   });
  941. </script>
  942.  
  943. <?php
  944.    //}
  945.  }
  946.  
  947. //Ativando Fancyapps Image
  948. add_action('wp_head', 'activate_fancyapps');
  949. function activate_fancyapps(){
  950.    // if( is_home() ) {
  951. ?>
  952.  
  953. <script type="text/javascript">
  954.   jQuery(document).ready(function() {
  955.     jQuery(".fancybox-custom-image").fancybox();
  956.   });
  957. </script>
  958.  
  959. <?php
  960.    // }
  961.  }
  962.  
  963.  
  964.  include('includes/metabox.php');
  965.  
  966. //add class Fancybox to image post
  967. add_filter('the_content', 'add_gallery_id_rel');
  968. function add_gallery_id_rel($link) {
  969.     global $post;
  970.     return str_replace('<a href', '<a class="fancybox-custom-image" rel="gallery1" href', $link);
  971. }
  972.  
  973.  
  974. function wp_pagination( $query=null, $wpcpn_posts=null )
  975. {
  976.     global $wp_query;
  977.     $query = $query ? $query : $wp_query;
  978.     $big = 999999999;
  979.     $max_num_pages = $query->max_num_pages;
  980.  
  981.     $paginate = paginate_links(
  982.         array(
  983.             'base'      => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
  984.             'type'      => 'array',
  985.             'total'     => $max_num_pages,
  986.             'format'    => '?paged=%#%',
  987.             'current'   => max( 1, get_query_var('paged') ),
  988.             'prev_text' => __('&laquo;'),
  989.             'next_text' => __('&raquo;'),
  990.         )
  991.     );
  992.     if ( $max_num_pages > 1 && $paginate ) {
  993.         echo '<ul class="pagination pagination-lg">';
  994.         foreach ( $paginate as $page ) {
  995.             echo '<li>' . $page . '</li>';
  996.         }
  997.         echo '</ul>';
  998.     }
  999. }
  1000.  
  1001.  
  1002. ?>
Add Comment
Please, Sign In to add comment