Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'after_setup_theme', 'pmc_Scribbo_theme_setup' );
- function pmc_Scribbo_theme_setup() {
- global $pmc_data;
- /*text domain*/
- load_theme_textdomain( 'pmc-themes', get_template_directory() . '/lang' );
- /*woocommerce support*/
- add_theme_support( 'post-formats', array( 'link', 'gallery', 'video' , 'audio') );
- /*feed support*/
- add_theme_support( 'automatic-feed-links' );
- /*post thumb support*/
- add_theme_support( 'post-thumbnails' ); // this enable thumbnails and stuffs
- /*setting thumb size*/
- add_image_size( 'gallery', 185,185, true );
- add_image_size( 'widget', 90,60, true );
- add_image_size( 'postBlock', 370,260, true );
- add_image_size( 'blog', 1180, 550, true );
- add_image_size( 'related', 370,250, true );
- register_nav_menus(array(
- 'pmcmainmenu' => 'Main Menu',
- 'pmcrespmenu' => 'Responsive Menu',
- 'pmcscrollmenu' => 'Scroll Menu'
- ));
- register_sidebar(array(
- 'id' => 'sidebar',
- 'name' => 'Sidebar main',
- 'before_widget' => '<div class="widget %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<h3>',
- 'after_title' => '</h3><div class="widget-line"></div>'
- ));
- register_sidebar(array(
- 'id' => 'footer1',
- 'name' => 'Footer sidebar 1',
- 'before_widget' => '<div class="widget %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<h3>',
- 'after_title' => '</h3>'
- ));
- register_sidebar(array(
- 'id' => 'footer2',
- 'name' => 'Footer sidebar 2',
- 'before_widget' => '<div class="widget %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<h3>',
- 'after_title' => '</h3>'
- ));
- register_sidebar(array(
- 'id' => 'footer3',
- 'name' => 'Footer sidebar 3',
- 'before_widget' => '<div class="widget %2$s">',
- 'after_widget' => '</div>',
- 'before_title' => '<h3>',
- 'after_title' => '</h3>'
- ));
- register_sidebar(array(
- 'id' => 'banner-topo1',
- 'name' => 'Banner Topo',
- 'before_widget' => '<li id="%1$s" class="widget %2$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h3>',
- 'after_title' => '</h3>'
- ));
- register_sidebar(array(
- 'id' => 'banner-bottom',
- 'name' => 'Banner Rodapé',
- 'before_widget' => '<li id="%1$s" class="widget %2$s">',
- 'after_widget' => '</li>',
- 'before_title' => '<h3>',
- 'after_title' => '</h3>'
- ));
- // Responsive walker menu
- class pmc_Walker_Responsive_Menu extends Walker_Nav_Menu {
- function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
- global $wp_query;
- $item_output = $attributes = $prepend ='';
- $class_names = $value = '';
- $classes = empty( $item->classes ) ? array() : (array) $item->classes;
- $class_names = join( ' ', apply_filters( '', array_filter( $classes ), $item ) );
- $class_names = ' class="'. esc_attr( $class_names ) . '"';
- // Create a visual indent in the list if we have a child item.
- $visual_indent = ( $depth ) ? str_repeat(' <i class="fa fa-circle"></i>', $depth) : '';
- // Load the item URL
- $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
- // If we have hierarchy for the item, add the indent, if not, leave it out.
- // Loop through and output each menu item as this.
- if($depth != 0) {
- $item_output .= '<a '. $class_names . $attributes .'> <i class="fa fa-circle"></i>' . $item->title. '</a><br>';
- } else {
- $item_output .= '<a ' . $class_names . $attributes .'><strong>'.$prepend.$item->title.'</strong></a><br>';
- }
- // Make the output happen.
- $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
- }
- }
- // Main walker menu
- class pmc_Walker_Main_Menu extends Walker_Nav_Menu
- {
- function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
- $this->curItem = $item;
- global $wp_query;
- $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
- $class_names = $value = '';
- $classes = empty( $item->classes ) ? array() : (array) $item->classes;
- $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
- $class_names = ' class="'. esc_attr( $class_names ) . '"';
- $image = ! empty( $item->custom ) ? ' <img src="'.esc_attr($item->custom).'">' : '';
- $output .= $indent . '<li id="menu-item-'.rand(0,9999).'-'. $item->ID . '"' . $value . $class_names .' );">';
- $attributes_title = ! empty( $item->attr_title ) ? ' <i class="fa ' . esc_attr( $item->attr_title ) .'"></i>' : '';
- $attributes = ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
- $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
- $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
- $prepend = '';
- $append = '';
- if($depth != 0)
- {
- $append = $prepend = '';
- }
- $item_output = $args->before;
- $item_output .= '<a '. $attributes .'>';
- $item_output .= $attributes_title.$args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;
- $item_output .= $args->link_after;
- $item_output .= '</a>';
- $item_output .= $args->after;
- $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
- }
- }
- }
- /*-----------------------------------------------------------------------------------*/
- // Options Framework
- /*-----------------------------------------------------------------------------------*/
- // Paths to admin functions
- define('MY_TEXTDOMAIN', 'pmc-themes');
- define('ADMIN_PATH', get_stylesheet_directory() . '/admin/');
- define('BOX_PATH', get_stylesheet_directory() . '/includes/boxes/');
- define('ADMIN_DIR', get_template_directory_uri() . '/admin/');
- define('LAYOUT_PATH', ADMIN_PATH . '/layouts/');
- // You can mess with these 2 if you wish.
- $themedata = wp_get_theme(get_stylesheet_directory() . '/style.css');
- define('THEMENAME', $themedata['Name']);
- define('OPTIONS', 'of_options_pmc'); // Name of the database row where your options are stored
- if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
- //Call action that sets
- add_action('admin_head','pmc_options');
- }
- /* import theme options */
- function pmc_options() {
- if (!get_option('of_options_pmc')){
- $pmc_data = 'YTo1Nzp7czoxNDoic2hvd3Jlc3BvbnNpdmUiO3M6MToiMSI7czoxMDoidXNlX2Jsb2NrMSI7czoxOiIxIjtzOjEwOiJ1c2VfYmxvY2szIjtzOjE6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ZvciBlcnJvcnMsIHRoZW4gaGl0IHJlZnJlc2guPC9icj5PciB5b3UgY2FuIHNpbXBseSBjbGljayB0aGUgaWNvbiBiZWxvdyBhbmQgZ28gaG9tZTopDQo8YnI+PGJyPg0KPGEgaHJlZiA9IFwiaHR0cDovL3NjcmliYm8ucHJlbWl1bWNvZGluZy5jb21cIj48aW1nIHNyYyA9IFwiaHR0cDovL3NjcmliYm8ucHJlbWl1bWNvZGluZy5jb20vc2lkZWJhci93cC1jb250ZW50L3VwbG9hZHMvMjAxNC8xMi9ob3VzZS1pY29uLnBuZ1wiPjwvYT4iO3M6OToiY29weXJpZ2h0IjtzOjE4ODoiPGRpdiBjbGFzcyA9XCJsZWZ0LWZvb3Rlci1jb250ZW50XCI+wqkgMjAxMyBjb3B5cmlnaHQgUFJFTUlVTUNPRElORyAvLyBBbGwgcmlnaHRzIHJlc2VydmVkPC9kaXY+DQoNCjxkaXYgY2xhc3MgPVwicmlnaHQtZm9vdGVyLWNvbnRlbnRcIj5TY3JpYmJvIHdhcyBtYWRlIHdpdGggbG92ZSBieSBQcmVtaXVtY29kaW5nPC9kaXY+DQoiO3M6OToidXNlX2JveGVkIjtzOjA6IiI7fQ==';
- $pmc_data = unserialize(base64_decode($pmc_data)); //100% safe - ignore theme check nag
- update_option('of_options_pmc', $pmc_data);
- }
- //delete_option(OPTIONS);
- }
- // Build Options
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
- $root = get_template_directory() .'/';
- $admin = get_template_directory() . '/admin/';
- require_once ($admin . 'theme-options.php'); // Options panel settings and custom settings
- require_once ($admin . 'admin-interface.php'); // Admin Interfaces
- require_once ($admin . 'admin-functions.php'); // Theme actions based on options settings
- $includes = get_template_directory() . '/includes/';
- $widget_includes = get_template_directory() . '/includes/widgets/';
- /* include custom widgets */
- require_once ($widget_includes . 'recent_post_widget.php');
- require_once ($widget_includes . 'popular_post_widget.php');
- require_once ($widget_includes . 'social_widget.php');
- /* include scripts */
- function pmc_scripts() {
- global $pmc_data;
- /*scripts*/
- wp_enqueue_script('pmc_fitvideos', get_template_directory_uri() . '/js/jquery.fitvids.js', array('jquery'),true,true);
- wp_enqueue_script('pmc_scrollto', get_template_directory_uri() . '/js/jquery.scrollTo.js', array('jquery'),true,true);
- wp_enqueue_script('pmc_retinaimages', get_template_directory_uri() . '/js/retina.min.js', array('jquery'),true,true);
- wp_enqueue_script('pmc_customjs', get_template_directory_uri() . '/js/custom.js', array('jquery'),true,true);
- wp_enqueue_script('pmc_prettyphoto_n', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array('jquery'),true,true);
- wp_enqueue_script('pmc_bxSlider', get_template_directory_uri() . '/js/jquery.bxslider.js', array('jquery') ,true,true);
- wp_enqueue_script('pmc_easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', array('jquery'),true,true);
- /*style*/
- wp_enqueue_style( 'main', get_stylesheet_uri(), 'style');
- wp_enqueue_style( 'prettyp', get_template_directory_uri() . '/css/prettyPhoto.css', 'style');
- /*style*/
- wp_enqueue_style( 'main', get_stylesheet_uri(), 'style');
- if(isset($pmc_data['body_font'])){
- if(($pmc_data['body_font']['face'] != 'verdana') and ($pmc_data['body_font']['face'] != 'trebuchet') and
- ($pmc_data['body_font']['face'] != 'georgia') and ($pmc_data['body_font']['face'] != 'Helvetica Neue') and
- ($pmc_data['body_font']['face'] != 'times,tahoma') and ($pmc_data['body_font']['face'] != 'arial')) {
- if(isset($pmc_data['google_body_custom']) && $pmc_data['google_body_custom'] != ''){
- $font_explode = explode(' ' , $pmc_data['google_body_custom']);
- $font_body = '';
- $size = count($font_explode);
- $count = 0;
- if(count($font_explode) > 0){
- foreach($font_explode as $font){
- if($count < $size-1){
- $font_body .= $font_explode[$count].'+';
- }
- else{
- $font_body .= $font_explode[$count];
- }
- $count++;
- }
- }else{
- $font_body = $pmc_data['google_body_custom'];
- }
- }else{
- $font_body = $pmc_data['body_font']['face'];
- }
- wp_enqueue_style('googleFontbody', 'http://fonts.googleapis.com/css?family='.$font_body ,'',NULL);
- }
- }
- if(isset($pmc_data['heading_font'])){
- if(($pmc_data['heading_font']['face'] != 'verdana') and ($pmc_data['heading_font']['face'] != 'trebuchet') and
- ($pmc_data['heading_font']['face'] != 'georgia') and ($pmc_data['heading_font']['face'] != 'Helvetica Neue') and
- ($pmc_data['heading_font']['face'] != 'times,tahoma') and ($pmc_data['heading_font']['face'] != 'arial')) {
- if(isset($pmc_data['google_heading_custom']) && $pmc_data['google_heading_custom'] != ''){
- $font_explode = explode(' ' , $pmc_data['google_heading_custom']);
- $font_heading = '';
- $size = count($font_explode);
- $count = 0;
- if(count($font_explode) > 0){
- foreach($font_explode as $font){
- if($count < $size-1){
- $font_heading .= $font_explode[$count].'+';
- }
- else{
- $font_heading .= $font_explode[$count];
- }
- $count++;
- }
- }else{
- $font_heading = $pmc_data['google_heading_custom'];
- }
- }else{
- $font_heading = $pmc_data['heading_font']['face'];
- }
- wp_enqueue_style('googleFontHeading', 'http://fonts.googleapis.com/css?family='.$font_heading ,'',NULL);
- }
- }
- if(isset($pmc_data['menu_font']['face'])){
- if(($pmc_data['menu_font']['face'] != 'verdana') and ($pmc_data['menu_font']['face'] != 'trebuchet') and
- ($pmc_data['menu_font']['face']!= 'georgia') and ($pmc_data['menu_font']['face'] != 'Helvetica Neue') and
- ($pmc_data['menu_font']['face'] != 'times,tahoma') and ($pmc_data['menu_font']['face'] != 'arial')) {
- if(isset($pmc_data['google_menu_custom']) && $pmc_data['google_menu_custom'] != ''){
- $font_explode = explode(' ' , $pmc_data['google_menu_custom']);
- $font_menu = '';
- $size = count($font_explode);
- $count = 0;
- if(count($font_explode) > 0){
- foreach($font_explode as $font){
- if($count < $size-1){
- $font_menu .= $font_explode[$count].'+';
- }
- else{
- $font_menu .= $font_explode[$count];
- }
- $count++;
- }
- }else{
- $font_menu = $pmc_data['google_menu_custom'];
- }
- }else{
- $font_menu = $pmc_data['menu_font']['face'];
- }
- wp_enqueue_style('googleFontMenu', 'http://fonts.googleapis.com/css?family='.$font_menu ,'',NULL);
- }
- }
- wp_enqueue_style('options', get_stylesheet_directory_uri() . '/css/options.css', 'style');
- }
- add_action( 'wp_enqueue_scripts', 'pmc_scripts' );
- /*shorcode to excerpt*/
- remove_filter( 'get_the_excerpt', 'wp_trim_excerpt' ); //Remove the filter we don't want
- add_filter( 'get_the_excerpt', 'pmc_wp_trim_excerpt' ); //Add the modified filter
- add_filter( 'the_excerpt', 'do_shortcode' ); //Make sure shortcodes get processed
- function pmc_wp_trim_excerpt($text = '') {
- $raw_excerpt = $text;
- if ( '' == $text ) {
- $text = get_the_content('');
- //$text = strip_shortcodes( $text ); //Comment out the part we don't want
- $text = apply_filters('the_content', $text);
- $text = str_replace(']]>', ']]>', $text);
- $excerpt_length = apply_filters('excerpt_length', 55);
- $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
- $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
- }
- return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
- }
- /*add boxed to body class*/
- add_filter('body_class','pmc_body_class');
- function pmc_body_class($classes) {
- global $pmc_data;
- $class = '';
- if(isset($pmc_data['use_boxed'])){
- $classes[] = 'pmc_boxed';
- }
- return $classes;
- }
- /* custom breadcrumb */
- function pmc_breadcrumb($title = false) {
- global $pmc_data;
- $breadcrumb = '';
- if (!is_home()) {
- if($title == false){
- $breadcrumb .= '<a href="';
- $breadcrumb .= home_url();
- $breadcrumb .= '">';
- $breadcrumb .= __('Home', 'pmc-themes');
- $breadcrumb .= "</a> » ";
- }
- if (is_single()) {
- if (is_single()) {
- $name = '';
- if(!get_query_var($pmc_data['port_slug']) && !get_query_var('product')){
- $category = get_the_category(); +
- $category_id = get_cat_ID($category[0]->cat_name);
- $category_link = get_category_link($category_id);
- $name = '<a href="'. esc_url( $category_link ).'">'.$category[0]->cat_name .'</a>';
- }
- else{
- $taxonomy = 'portfoliocategory';
- $entrycategory = get_the_term_list( get_the_ID(), $taxonomy, '', ',', '' );
- $catstring = $entrycategory;
- $catidlist = explode(",", $catstring);
- $name = $catidlist[0];
- }
- if($title == false){
- $breadcrumb .= $name .' » <span>'. get_the_title().'</span>';
- }
- else{
- $breadcrumb .= get_the_title();
- }
- }
- } elseif (is_page()) {
- $breadcrumb .= '<span>'.get_the_title().'</span>';
- }
- elseif(get_query_var('portfoliocategory')){
- $term = get_term_by('slug', get_query_var('portfoliocategory'), 'portfoliocategory'); $name = $term->name;
- $breadcrumb .= '<span>'.$name.'</span>';
- }
- else if(is_tag()){
- $tag = get_query_var('tag');
- $tag = str_replace('-',' ',$tag);
- $breadcrumb .= '<span>'.$tag.'</span>';
- }
- else if(is_search()){
- $breadcrumb .= __('Search results for ', 'pmc-themes') .'"<span>'.get_search_query().'</span>"';
- }
- else if(is_category()){
- $cat = get_query_var('cat');
- $cat = get_category($cat);
- $breadcrumb .= '<span>'.$cat->name.'</span>';
- }
- else if(is_archive()){
- $breadcrumb .= '<span>'.__('Archive','pmc-themes').'</span>';
- }
- else{
- $breadcrumb .= 'Home';
- }
- }
- return $breadcrumb ;
- }
- /* social share links */
- function pmc_socialLinkSingle($link,$title) {
- $social = '';
- $social .= '<div class="addthis_toolbox">';
- $social .= '<div class="custom_images">';
- $social .= '<a class="addthis_button_instagram" addthis:url="'.esc_url($link).'" addthis:title="'.esc_attr($title).'"><i class="fa fa-instagram"></i></a>';
- $social .= '<a class="addthis_button_facebook" addthis:url="'.esc_url($link).'" addthis:title="'.esc_attr($title).'" ><i class="fa fa-facebook"></i></a>';
- // $social .= '<a class="addthis_button_twitter" addthis:url="'.esc_url($link).'" addthis:title="'.esc_attr($title).'"><i class="fa fa-twitter"></i></a>';
- $social .= '<a class="addthis_button_pinterest_share" addthis:url="'.esc_url($link).'" addthis:title="'.esc_attr($title).'"><i class="fa fa-pinterest"></i></a>';
- //$social .= '<a class="addthis_button_google" addthis:url="'.esc_url($link).'" g:plusone:count="false" addthis:title="'.esc_attr($title).'"></a>';
- $social .='</div><script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js"></script>';
- $social .= '</div>';
- echo $social;
- }
- /* links to social profile */
- function pmc_socialLink() {
- $social = '';
- global $pmc_data;
- $icons = $pmc_data['socialicons'];
- foreach ($icons as $icon){
- $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>';
- }
- echo $social;
- }
- add_filter('the_content', 'pmc_addlightbox');
- /* add lightbox to images*/
- function pmc_addlightbox($content)
- { global $post;
- $pattern = "/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";
- $replacement = '<a$1href=$2$3.$4$5 rel="lightbox[%LIGHTID%]"$6>';
- $content = preg_replace($pattern, $replacement, $content);
- if(isset($post->ID))
- $content = str_replace("%LIGHTID%", $post->ID, $content);
- return $content;
- }
- /* remove double // char */
- function pmc_stripText($string)
- {
- return str_replace("\\",'',$string);
- }
- /* custom post types */
- add_action('save_post', 'pmc_update_post_type');
- add_action("admin_init", "pmc_add_meta_box");
- function pmc_add_meta_box(){
- add_meta_box("pmc_post_type", "Post type", "pmc_post_type", "post", "normal", "high");
- }
- function pmc_post_type(){
- global $post;
- $pmc_data = get_post_custom(get_the_id());
- if (isset($pmc_data["video_post_url"][0])){
- $video_post_url = $pmc_data["video_post_url"][0];
- }else{
- $video_post_url = "";
- }
- if (isset($pmc_data["link_post_url"][0])){
- $link_post_url = $pmc_data["link_post_url"][0];
- }else{
- $link_post_url = "";
- }
- if (isset($pmc_data["audio_post_url"][0])){
- $audio_post_url = $pmc_data["audio_post_url"][0];
- }else{
- $audio_post_url = "";
- }
- if (isset($pmc_data["audio_post_title"][0])){
- $audio_post_title = $pmc_data["audio_post_title"][0];
- }else{
- $audio_post_title = "";
- }
- ?>
- <div id="portfolio-category-options">
- <table cellpadding="15" cellspacing="15">
- <tr class="videoonly" style="border-bottom:1px solid #000;">
- <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>
- </tr>
- <tr class="linkonly" >
- <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>
- </tr>
- <tr class="audioonly">
- <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>
- </tr>
- <tr class="audioonly">
- <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>
- </tr>
- <tr class="nooptions">
- <td>No options for this post type.</td>
- </tr>
- </table>
- </div>
- <style>
- #portfolio-category-options td {width:50%}
- #portfolio-category-options input {width:100%}
- </style>
- <script>
- jQuery(document).ready(function(){
- if (jQuery("input[name=post_format]:checked").val() == 'video'){
- jQuery('.videoonly').show();
- jQuery('.audioonly, .linkonly , .nooptions').hide();}
- else if (jQuery("input[name=post_format]:checked").val() == 'link'){
- jQuery('.linkonly').show();
- jQuery('.videoonly, .select_video,.nooptions').hide(); }
- else if (jQuery("input[name=post_format]:checked").val() == 'audio'){
- jQuery('.videoonly, .linkonly,.nooptions').hide();
- jQuery('.audioonly').show();}
- else{
- jQuery('.videoonly').hide();
- jQuery('.audioonly').hide();
- jQuery('.linkonly').hide();
- jQuery('.nooptions').show();}
- jQuery("input[name=post_format]").change(function(){
- if (jQuery("input[name=post_format]:checked").val() == 'video'){
- jQuery('.videoonly').show();
- jQuery('.audioonly, .linkonly,.nooptions').hide();}
- else if (jQuery("input[name=post_format]:checked").val() == 'link'){
- jQuery('.linkonly').show();
- jQuery('.videoonly, .audioonly,.nooptions').hide(); }
- else if (jQuery("input[name=post_format]:checked").val() == 'audio'){
- jQuery('.videoonly, .linkonly,.nooptions').hide();
- jQuery('.audioonly').show();}
- else{
- jQuery('.videoonly').hide();
- jQuery('.audioonly').hide();
- jQuery('.linkonly').hide();
- jQuery('.nooptions').show();}
- });
- });
- </script>
- <?php
- }
- function pmc_update_post_type(){
- global $post;
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
- return $post_id;
- }
- if($post){
- if( isset($_POST["video_post_url"]) ) {
- update_post_meta($post->ID, "video_post_url", $_POST["video_post_url"]);
- }
- if( isset($_POST["link_post_url"]) ) {
- update_post_meta($post->ID, "link_post_url", $_POST["link_post_url"]);
- }
- if( isset($_POST["audio_post_url"]) ) {
- update_post_meta($post->ID, "audio_post_url", $_POST["audio_post_url"]);
- }
- if( isset($_POST["audio_post_title"]) ) {
- update_post_meta($post->ID, "audio_post_title", $_POST["audio_post_title"]);
- }
- }
- }
- if( !function_exists( 'Scribbo_fallback_menu' ) )
- {
- function Scribbo_fallback_menu()
- {
- $current = "";
- if (is_front_page()){$current = "class='current-menu-item'";}
- echo "<div class='fallback_menu'>";
- echo "<ul class='Scribbo_fallback menu'>";
- echo "<li $current><a href='".esc_url(home_url())."'>Home</a></li>";
- wp_list_pages('title_li=&sort_column=menu_order');
- echo "</ul></div>";
- }
- }
- add_filter( 'the_category', 'pmc_add_nofollow_cat' );
- function pmc_add_nofollow_cat( $text ) {
- $text = str_replace('rel="category tag"', "", $text);
- return $text;
- }
- /* get image from post */
- function pmc_getImage($id, $image){
- $return = '';
- if ( has_post_thumbnail() ){
- $return = get_the_post_thumbnail($id,$image);
- }
- else
- $return = '';
- return $return;
- }
- if ( ! isset( $content_width ) ) $content_width = 800;
- function pmc_excerpt_more( $more ) {
- return ' ...';
- }
- add_filter('excerpt_more', 'pmc_excerpt_more');
- /*import plugins*/
- function pmc_add_this_script_footer(){
- global $pmc_data;
- ?>
- <script>
- jQuery(document).ready(function(){
- jQuery('.searchform #s').attr('value','<?php _e('','pmc-themes'); ?>');
- jQuery('.searchform #s').focus(function() {
- jQuery('.searchform #s').val('');
- });
- jQuery('.searchform #s').focusout(function() {
- if(jQuery('.searchform #s').attr('value') == '')
- jQuery('.searchform #s').attr('value','<?php _e('','pmc-themes'); ?>');
- });
- jQuery("a[rel^='lightbox']").prettyPhoto({theme:'light_rounded',show_title: true, deeplinking:false,callback:function(){scroll_menu()}});
- }); </script>
- <?php }
- add_action('wp_footer', 'pmc_add_this_script_footer');
- //Chamando OWL Carousel
- add_action('wp_enqueue_scripts', 'enqueue_owl');
- function enqueue_owl(){
- wp_enqueue_script('owl', get_template_directory_uri().'/js/owl-carousel/owl.carousel.js', array('jquery'));
- }
- //Ativando OWL Carousel Calendar
- add_action('wp_footer', 'activate_owl');
- function activate_owl(){
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function() {
- jQuery(".owl_carousel").owlCarousel({
- autoPlay: 3000, //Set AutoPlay to 3 seconds
- items : 4,
- itemsDesktop : [1199,4],
- itemsDesktopSmall : [979,4],
- itemsTablet: [768,3],
- itemsMobile : [750,1],
- pagination : true,
- paginationNumbers: false
- });
- });
- </script>
- <?php
- }
- add_action('init', 'type_post_team');
- function type_post_team() {
- $labels = array(
- 'name' => _x('Team', 'post type general name'),
- 'singular_name' => _x('Team', 'post type singular name'),
- 'add_new' => 'Novo Cadastro',
- 'all_items' => 'Todos os Cadastros',
- 'add_new_item' => 'Adicionar Novo Cadastro',
- 'edit_item' => 'Editar Cadastro',
- 'new_item' => 'Novo Cadastro',
- 'view_item' => 'Visualizar Cadastro',
- 'search_items' => 'Buscar Cadastro',
- 'not_found' => 'Nenhum Cadastro encontrado',
- 'not_found_in_trash' => 'Nenhum Cadastro encontrado na lixeira',
- 'menu_name' => 'Team'
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'menu_position' => 5,
- //'register_meta_box_cb' => 'servicos_meta_box',
- 'supports' => array('title','thumbnail','editor','custom-fields', 'page-attributes', 'post-formats', 'trackbacks'),
- 'taxonomies' => array('post_tag')
- );
- register_post_type( 'team' , $args );
- /*register_taxonomy("categorias", array("consultores"), array(
- "hierarchical" => true,
- "label" => "Categorias",
- "singular_label" =>
- "Categoria",
- // "rewrite" => true
- "rewrite" => array(
- // 'with_front' => false,
- 'hierarchical' => true
- )
- ));*/
- flush_rewrite_rules();
- }
- add_action('init', 'type_post_press');
- function type_post_press() {
- $labels = array(
- 'name' => _x('Press', 'post type general name'),
- 'singular_name' => _x('Press', 'post type singular name'),
- 'add_new' => 'Novo Cadastro',
- 'all_items' => 'Todos os Cadastros',
- 'add_new_item' => 'Adicionar Novo Cadastro',
- 'edit_item' => 'Editar Cadastro',
- 'new_item' => 'Novo Cadastro',
- 'view_item' => 'Visualizar Cadastro',
- 'search_items' => 'Buscar Cadastro',
- 'not_found' => 'Nenhum Cadastro encontrado',
- 'not_found_in_trash' => 'Nenhum Cadastro encontrado na lixeira',
- 'menu_name' => 'Press'
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'menu_position' => 5,
- //'register_meta_box_cb' => 'servicos_meta_box',
- 'supports' => array('title','thumbnail','editor','custom-fields', 'page-attributes', 'post-formats', 'trackbacks'),
- //'taxonomies' => array('post_tag')
- );
- register_post_type( 'press' , $args );
- /*register_taxonomy("categorias", array("consultores"), array(
- "hierarchical" => true,
- "label" => "Categorias",
- "singular_label" =>
- "Categoria",
- // "rewrite" => true
- "rewrite" => array(
- // 'with_front' => false,
- 'hierarchical' => true
- )
- ));*/
- flush_rewrite_rules();
- }
- add_action('init', 'type_post_gastronomia');
- function type_post_gastronomia() {
- $labels = array(
- 'name' => _x('Gastronomia', 'post type general name'),
- 'singular_name' => _x('Gastronomia', 'post type singular name'),
- 'add_new' => 'Novo Cadastro',
- 'all_items' => 'Todos os Cadastros',
- 'add_new_item' => 'Adicionar Novo Cadastro',
- 'edit_item' => 'Editar Cadastro',
- 'new_item' => 'Novo Cadastro',
- 'view_item' => 'Visualizar Cadastro',
- 'search_items' => 'Buscar Cadastro',
- 'not_found' => 'Nenhum Cadastro encontrado',
- 'not_found_in_trash' => 'Nenhum Cadastro encontrado na lixeira',
- 'menu_name' => 'Gastronomia'
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'menu_position' => 5,
- //'register_meta_box_cb' => 'servicos_meta_box',
- 'supports' => array('title','thumbnail','editor','custom-fields', 'page-attributes', 'post-formats', 'trackbacks','excerpt'),
- 'taxonomies' => array('post_tag')
- );
- register_post_type( 'gastronomia' , $args );
- register_taxonomy("tax_gastronomia", array("gastronomia"), array(
- "hierarchical" => true,
- "label" => "Categorias",
- "singular_label" =>
- "Categoria",
- // "rewrite" => true
- "rewrite" => array(
- // 'with_front' => false,
- 'hierarchical' => true
- )
- ));
- flush_rewrite_rules();
- }
- add_action('init', 'type_post_lifestyle');
- function type_post_lifestyle() {
- $labels = array(
- 'name' => _x('Lifestyle', 'post type general name'),
- 'singular_name' => _x('Lifestyle', 'post type singular name'),
- 'add_new' => 'Novo Cadastro',
- 'all_items' => 'Todos os Cadastros',
- 'add_new_item' => 'Adicionar Novo Cadastro',
- 'edit_item' => 'Editar Cadastro',
- 'new_item' => 'Novo Cadastro',
- 'view_item' => 'Visualizar Cadastro',
- 'search_items' => 'Buscar Cadastro',
- 'not_found' => 'Nenhum Cadastro encontrado',
- 'not_found_in_trash' => 'Nenhum Cadastro encontrado na lixeira',
- 'menu_name' => 'Lifestyle'
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'menu_position' => 5,
- //'register_meta_box_cb' => 'servicos_meta_box',
- 'supports' => array('title','thumbnail','editor','custom-fields', 'page-attributes', 'post-formats', 'trackbacks','excerpt'),
- 'taxonomies' => array('post_tag')
- );
- register_post_type( 'lifestyle' , $args );
- register_taxonomy("tax_lifestyle", array("lifestyle"), array(
- "hierarchical" => true,
- "label" => "Categorias",
- "singular_label" =>
- "Categoria",
- // "rewrite" => true
- "rewrite" => array(
- // 'with_front' => false,
- 'hierarchical' => true
- )
- ));
- flush_rewrite_rules();
- }
- add_action('init', 'type_post_entretenimento');
- function type_post_entretenimento() {
- $labels = array(
- 'name' => _x('Entretenimento', 'post type general name'),
- 'singular_name' => _x('Entretenimento', 'post type singular name'),
- 'add_new' => 'Novo Cadastro',
- 'all_items' => 'Todos os Cadastros',
- 'add_new_item' => 'Adicionar Novo Cadastro',
- 'edit_item' => 'Editar Cadastro',
- 'new_item' => 'Novo Cadastro',
- 'view_item' => 'Visualizar Cadastro',
- 'search_items' => 'Buscar Cadastro',
- 'not_found' => 'Nenhum Cadastro encontrado',
- 'not_found_in_trash' => 'Nenhum Cadastro encontrado na lixeira',
- 'menu_name' => 'Entretenimento'
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'menu_position' => 5,
- //'register_meta_box_cb' => 'servicos_meta_box',
- 'supports' => array('title','thumbnail','editor','custom-fields', 'page-attributes', 'post-formats', 'trackbacks','excerpt'),
- 'taxonomies' => array('post_tag')
- );
- register_post_type( 'entretenimento' , $args );
- register_taxonomy("tax_entretenimento", array("entretenimento"), array(
- "hierarchical" => true,
- "label" => "Categorias",
- "singular_label" =>
- "Categoria",
- // "rewrite" => true
- "rewrite" => array(
- // 'with_front' => false,
- 'hierarchical' => true
- )
- ));
- flush_rewrite_rules();
- }
- //custom single
- add_filter('single_template', 'check_for_category_single_template');
- function check_for_category_single_template( $t ){
- foreach( (array) get_the_category() as $cat ){
- if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") ) return TEMPLATEPATH . "/single-{$cat->slug}.php";
- if($cat->parent){
- $cat = get_the_category_by_ID( $cat->parent );
- if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") ) return TEMPLATEPATH . "/single-{$cat->slug}.php";
- }
- }
- return $t;
- }
- //Chamando Fancyapps
- add_action('wp_enqueue_scripts', 'enqueue_fancyapps');
- function enqueue_fancyapps(){
- //if( is_home() || is_single() || is_page('A Empresa') )
- wp_enqueue_script('fancyapps', get_template_directory_uri().'/js/fancybox/source/jquery.fancybox.pack.js', array('jquery'));
- }
- //Ativando Fancyapps iFrame
- add_action('wp_head', 'activate_fancyapps_iframe');
- function activate_fancyapps_iframe(){
- //if( is_page('Time') ) {
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function() {
- jQuery(".fancybox").fancybox({
- type : 'iframe',
- width: 700,
- height: 500
- });
- });
- </script>
- <?php
- //}
- }
- //Ativando Fancyapps Image
- add_action('wp_head', 'activate_fancyapps');
- function activate_fancyapps(){
- // if( is_home() ) {
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function() {
- jQuery(".fancybox-custom-image").fancybox();
- });
- </script>
- <?php
- // }
- }
- include('includes/metabox.php');
- //add class Fancybox to image post
- add_filter('the_content', 'add_gallery_id_rel');
- function add_gallery_id_rel($link) {
- global $post;
- return str_replace('<a href', '<a class="fancybox-custom-image" rel="gallery1" href', $link);
- }
- function wp_pagination( $query=null, $wpcpn_posts=null )
- {
- global $wp_query;
- $query = $query ? $query : $wp_query;
- $big = 999999999;
- $max_num_pages = $query->max_num_pages;
- $paginate = paginate_links(
- array(
- 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
- 'type' => 'array',
- 'total' => $max_num_pages,
- 'format' => '?paged=%#%',
- 'current' => max( 1, get_query_var('paged') ),
- 'prev_text' => __('«'),
- 'next_text' => __('»'),
- )
- );
- if ( $max_num_pages > 1 && $paginate ) {
- echo '<ul class="pagination pagination-lg">';
- foreach ( $paginate as $page ) {
- echo '<li>' . $page . '</li>';
- }
- echo '</ul>';
- }
- }
- ?>
Add Comment
Please, Sign In to add comment