Advertisement
Guest User

Untitled

a guest
Mar 19th, 2014
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 58.37 KB | None | 0 0
  1. <?php
  2. /*
  3. **
  4. **    Author: Gabriel Tadeu
  5. **    URL: htp://gabrieltadeu.com/
  6. **
  7. */
  8.  
  9. // Set the content width based on the theme's design and stylesheet.
  10. if ( ! isset( $content_width ) )
  11.     $content_width = 730; /* pixels */
  12.  
  13. // Firing all out initial functions at the start
  14. add_action( 'after_setup_theme','ahoy', 15 );
  15.  
  16. function ahoy() {
  17.     // launching operation cleanup
  18.     add_action( 'init', 'head_cleanup' );
  19.     // remove WP version from RSS
  20.     add_filter( 'the_generator', 'rss_version' );
  21.     // remove pesky injected css for recent comments widget
  22.     add_filter( 'wp_head', 'remove_wp_widget_recent_comments_style', 1 );
  23.     // clean up comment styles in the head
  24.     add_action( 'wp_head', 'remove_recent_comments_style', 1 );
  25.     // clean up gallery output in wp
  26.     add_filter( 'the_content', 'remove_br_gallery', 11, 2);
  27.     // enqueue cdn jquery scripts
  28.     add_action( 'wp_enqueue_scripts', 'cdn_jquery' );
  29.     // launching this stuff after theme setup
  30.     add_filter( 'acf/fields/wysiwyg/toolbars' , 'my_toolbars' );
  31.     //add_filter( 'mce_buttons', 'ilc_mce_buttons' );
  32.     add_action( 'after_setup_theme','theme_support' );
  33.     // adding the search form
  34.     add_filter( 'get_search_form', 'wpsearch' );
  35.     // cleaning up random code around images
  36.     add_filter( 'the_content', 'filter_ptags_on_images' );
  37.     // cleaning up excerpt
  38.     add_filter( 'excerpt_more', 'excerpt_more' );
  39.     //Page w/ excerpt
  40.     add_action( 'init', 'my_add_excerpts_to_pages' );
  41.     // removing the dashboard widgets
  42.     add_action( 'admin_menu', 'disable_default_dashboard_widgets' );
  43.     // Better title
  44.     add_filter( 'wp_title', 'gt_wp_title', 10, 2 );
  45.     // adding the function to the Wordpress init
  46.     add_action( 'init', 'gt_custom_post');
  47.     //Taxonomies Post class
  48.     add_filter( 'post_class', 'custom_taxonomy_post_class', 10, 3 );
  49.     //Performace counter
  50.     add_action( 'wp_footer', 'footer_db_queries' );
  51.     // Disable wp admin bar
  52.     add_filter( 'show_admin_bar', '__return_false' );
  53.     //Shortcode
  54.     add_shortcode('vid','vid_sc');
  55. }
  56.  
  57. function head_cleanup() {
  58.     // category feeds
  59.     remove_action( 'wp_head', 'feed_links_extra', 3 );
  60.     // post and comment feeds
  61.     remove_action( 'wp_head', 'feed_links', 2 );
  62.     // EditURI link
  63.     remove_action( 'wp_head', 'rsd_link' );
  64.     // windows live writer
  65.     remove_action( 'wp_head', 'wlwmanifest_link' );
  66.     // index link
  67.     remove_action( 'wp_head', 'index_rel_link' );
  68.     // previous link
  69.     remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
  70.     // start link
  71.     remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
  72.     // links for adjacent posts
  73.     remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
  74.     // WP version
  75.     remove_action( 'wp_head', 'wp_generator' );
  76.     // remove WP version from css
  77.     add_filter( 'style_loader_src', 'remove_wp_ver_css_js', 9999 );
  78.     // remove Wp version from scripts
  79.     add_filter( 'script_loader_src', 'remove_wp_ver_css_js', 9999 );
  80. }
  81.  
  82. function remove_wp_ver_css_js( $src ) {
  83.     // remove WP version from scripts
  84.     if ( strpos( $src, 'ver=' ) )
  85.         $src = remove_query_arg( 'ver', $src );
  86.     return $src;
  87. }
  88.  
  89. function rss_version() {
  90.     // remove WP version from RSS
  91.     return '';
  92. }
  93.  
  94. function remove_wp_widget_recent_comments_style() {
  95. // remove injected CSS for recent comments widget
  96.    if ( has_filter( 'wp_head', 'wp_widget_recent_comments_style' ) ) {
  97.       remove_filter( 'wp_head', 'wp_widget_recent_comments_style' );
  98.    }
  99. }
  100.  
  101. function remove_recent_comments_style() {
  102.     // remove injected CSS from recent comments widget
  103.     global $wp_widget_factory;
  104.  
  105.     if ( isset( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'] ) ) {
  106.         remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
  107.     }
  108. }
  109.  
  110. function remove_br_gallery($output) {
  111.     // add_filter( 'use_default_gallery_style', '__return_false' );
  112.  
  113.     return preg_replace('/\<br[^\>]*\>/', '', $output);
  114. }
  115.  
  116. function cdn_jquery() {
  117.     // Deregister core-bundled jQuery
  118.     // This is dangerous! Understand the
  119.     // potential consequences before doing this!
  120.     wp_deregister_script( 'jquery' );
  121.     // Register custom jQuery version
  122.     wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js' );
  123.     // Enqueue cusotm jQuery
  124.     wp_enqueue_script( 'jquery' );
  125. }
  126.  
  127. function ilc_mce_buttons($buttons) {
  128.     //array_push($buttons, "backcolor", "anchor", "hr", "fontselect", "sub", "sup");
  129.     array_push($buttons, "sub", "sup");
  130.     return $buttons;
  131. }
  132.  
  133. function my_toolbars( $toolbars ) {
  134.     // Uncomment to view format of $toolbars
  135.     /*
  136.     echo '< pre >';
  137.         print_r($toolbars);
  138.     echo '< /pre >';
  139.     //die;
  140.  
  141.     // Add a new toolbar called "Very Simple"
  142.     // - this toolbar has only 1 row of buttons
  143.     $toolbars['Enough'] = array();
  144.     $toolbars['Enough'][1] = array(
  145.         'bold',
  146.         'italic',
  147.         'strikethrough',
  148.         'underline',
  149.         'bullist',
  150.         'numlist',
  151.         'blockquote',
  152.         'justifyleft',
  153.         'justifycenter',
  154.         'justifyright',
  155.         'justifyfull',
  156.         'link',
  157.         'unlink',
  158.         'wp_more',
  159.         'spellchecker',
  160.         'fullscreen',
  161.         'formatselect',
  162.         'forecolor',
  163.         'pastetext',
  164.         'pasteword',
  165.         'removeformat',
  166.         'charmap',
  167.         'outdent',
  168.         'indent',
  169.         'undo',
  170.         'redo',
  171.         'wp_help',
  172.         'code',
  173.         'backcolor',
  174.         'anchor',
  175.         'hr',
  176.         'fontselect',
  177.         'sub',
  178.         'sup'
  179.     );
  180.     */
  181.  
  182.     $toolbars['List'] = array();
  183.     $toolbars['List'][1] = array(
  184.         'bullist',
  185.         'outdent',
  186.         'indent',
  187.         'bold',
  188.         'italic',
  189.         'strikethrough',
  190.         'link',
  191.         'unlink',
  192.         'sub',
  193.         'sup',
  194.         'pastetext',
  195.         'pasteword',
  196.         'removeformat',
  197.         'charmap',
  198.         'fullscreen',
  199.     );
  200.  
  201.     /*
  202.     // Edit the "Full" toolbar and remove 'code'
  203.     // - delet from array code from http://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key
  204.     if( ($key = array_search('code' , $toolbars['Full' ][2])) !== false )
  205.     {
  206.         unset( $toolbars['Full' ][2][$key] );
  207.     }
  208.  
  209.     // remove the 'Basic' toolbar completely
  210.     unset( $toolbars['Basic' ] );
  211.     */
  212.  
  213.     // return $toolbars - IMPORTANT!
  214.     return $toolbars;
  215. }
  216.  
  217. function theme_support() {
  218.     // wp thumbnails ( sizes handled in functions.php )
  219.     add_theme_support( 'post-thumbnails' );
  220.     add_image_size( 'mini', 120, 120, true );
  221.     add_image_size( 'module', 280, 210, true );
  222.     add_image_size( 'project', 1440, 475, true );
  223.     add_image_size( 'background', 1440, 900, true );
  224.  
  225.     // Supports all available post formats.
  226.     // add_theme_support( 'structured-post-formats', array( 'video', 'gallery' ) );
  227.     // add_theme_support( 'post-formats', array( 'video', 'gallery' ) );
  228.  
  229.     // rss thingy
  230.     // add_theme_support('automatic-feed-links');
  231.     add_action('wp_head', 'addBackPostFeed');
  232.  
  233.     // wp menus
  234.     add_theme_support( 'menus' );
  235.  
  236.     // registering wp3+ menus
  237.     register_nav_menus(
  238.         array(
  239.             'main-nav' => 'Menu',
  240.             'user-nav' => 'User',
  241.         )
  242.     );
  243. }
  244.  
  245. function addBackPostFeed() {
  246.     echo '<link rel="alternate" type="application/rss+xml" title="RSS 2.0 Feed" href="'.get_bloginfo('rss2_url').'" />';
  247. }
  248.  
  249. function wpsearch( $form ) {
  250.     // Search Form ' . get_search_query() . '
  251.     $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
  252.                        <fieldset>
  253.                             <input type="text" value="' . get_search_query() . '" name="s" id="s" autocomplete="off" />
  254.                             <button type="submit" id="searchsubmit"><span class="ir">Search</span></button>
  255.                         </fieldset>
  256.                    </form>';
  257.  
  258.     return $form;
  259. }
  260.  
  261. function filter_ptags_on_images( $content ){
  262.     // remove the p from around imgs ( http://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/ )
  263.     return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
  264. }
  265.  
  266. function excerpt_more( $more ) {
  267.     // This removes the annoying […] to a Read More link
  268.     global $post;
  269.     // edit here if you like
  270.     return '...';
  271. }
  272.  
  273. function my_add_excerpts_to_pages() {
  274.     add_post_type_support( 'page', 'excerpt' );
  275. }
  276.  
  277. function disable_default_dashboard_widgets() {
  278.     // disable default dashboard widgets
  279.  
  280.     //remove_meta_box( 'dashboard_right_now', 'dashboard', 'core' );    // Right Now Widget
  281.     //remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'core' ); // Comments Widget
  282.     remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'core' );  // Incoming Links Widget
  283.     remove_meta_box( 'dashboard_plugins', 'dashboard', 'core' );         // Plugins Widget
  284.  
  285.     remove_meta_box( 'dashboard_quick_press', 'dashboard', 'core' );  // Quick Press Widget
  286.     //remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'core' );   // Recent Drafts Widget
  287.     remove_meta_box( 'dashboard_primary', 'dashboard', 'core' );         //
  288.     remove_meta_box( 'dashboard_secondary', 'dashboard', 'core' );       //
  289.  
  290.     //removing plugin dashboard boxes
  291.     remove_meta_box( 'yoast_db_widget', 'dashboard', 'normal' );         // Yoast's SEO Plugin Widget
  292. }
  293.  
  294. function gt_wp_title( $title, $sep ) {
  295.     global $paged, $page;
  296.  
  297.     if ( is_feed() )
  298.         return $title;
  299.  
  300.     // Add the site name.
  301.     $title .= get_bloginfo( 'name' );
  302.  
  303.     // Add the site description for the home/front page.
  304.     $site_description = get_bloginfo( 'description', 'display' );
  305.     if ( $site_description && ( is_home() || is_front_page() ) )
  306.         $title = "$title $sep $site_description";
  307.  
  308.     // Add a page number if necessary.
  309.     if ( $paged >= 2 || $page >= 2 )
  310.         $title = "$title $sep " . sprintf( 'Página', max( $paged, $page ) );
  311.  
  312.     return $title;
  313. }
  314.  
  315. function gt_custom_post() {
  316.  
  317.     // creating ( registering ) the custom type
  318.     $labels = array(
  319.         'name' => 'Projetos',
  320.         'singular_name' => 'Projeto',
  321.         'all_items' => 'Todos os Projetos',
  322.         'add_new' => 'Adicione um novo',
  323.         'add_new_item' => 'Adicione um novo Projeto',
  324.         'edit' => 'Editar',
  325.         'edit_item' => 'Editar Projeto',
  326.         'new_item' => 'Novo Projeto',
  327.         'view_item' => 'Ver Projeto',
  328.         'search_items' => 'Procurar Projetos',
  329.         'not_found' =>  'Nenhum Projeto encontrado',
  330.         'not_found_in_trash' => 'Nenhum Projeto na lixeira',
  331.         'parent_item_colon' => ''
  332.         );
  333.  
  334.     $projetos = array(
  335.             //'menu_icon'         => get_stylesheet_directory_uri() . '/library/images/custom-post-icon.png', /* the icon for the custom post type menu */
  336.             'label'               => 'projetos',
  337.             'description'         => '',
  338.             'labels'              => $labels,
  339.             'supports'            => array('author', 'title', 'editor', 'thumbnail', 'revisions', 'custom-fields', 'page-attributes', 'excerpt'), //, 'author'
  340.             'menu_icon'           => 'dashicons-portfolio',
  341.             'capability_type'     => 'page',
  342.             'exclude_from_search' => false,
  343.             'hierarchical'        => true,
  344.             'public'              => true,
  345.             'show_ui'             => true,
  346.             'show_in_menu'        => true,
  347.             'show_in_nav_menus'   => true,
  348.             'show_in_admin_bar'   => true,
  349.             'menu_position'       => 20,
  350.             'can_export'          => true,
  351.             'has_archive'         => true,
  352.             'publicly_queryable'  => true,
  353.             'query_var'           => true,
  354.             'rewrite'             => false, //array('slug' => false, 'with_front' => false, 'paged' => false, 'feed' => false),
  355.         ); // ( http://codex.wordpress.org/Function_Reference/register_post_type )
  356.  
  357.     register_post_type('projetos', $projetos);
  358.     register_taxonomy_for_object_type('category', 'projetos');
  359.     register_taxonomy_for_object_type('post_tag', 'projetos');
  360.  
  361.  
  362.  
  363.     // creating ( registering ) the custom type
  364.     $labels = array(
  365.         'name' => 'Backgrounds',
  366.         'singular_name' => 'Background',
  367.         'all_items' => 'Todos os Backgrounds',
  368.         'add_new' => 'Adicione um novo',
  369.         'add_new_item' => 'Adicione um novo Background',
  370.         'edit' => 'Editar',
  371.         'edit_item' => 'Editar Background',
  372.         'new_item' => 'Novo Background',
  373.         'view_item' => 'Ver Background',
  374.         'search_items' => 'Procurar Backgrounds',
  375.         'not_found' =>  'Nenhum Background encontrado',
  376.         'not_found_in_trash' => 'Nenhum Background na lixeira',
  377.         'parent_item_colon' => ''
  378.         );
  379.  
  380.     $backgrounds = array(
  381.             //'menu_icon'         => get_stylesheet_directory_uri() . '/library/images/custom-post-icon.png', /* the icon for the custom post type menu */
  382.             'label'               => 'backgrounds',
  383.             'description'         => '',
  384.             'labels'              => $labels,
  385.             'supports'            => array('title', 'thumbnail'), //, 'author'
  386.             'capability_type'     => 'page',
  387.             'menu_icon'           => 'dashicons-format-gallery',
  388.             'exclude_from_search' => true,
  389.             'hierarchical'        => false,
  390.             'public'              => true,
  391.             'show_ui'             => true,
  392.             'show_in_menu'        => true,
  393.             'show_in_nav_menus'   => true,
  394.             'show_in_admin_bar'   => true,
  395.             'menu_position'       => 10,
  396.             'can_export'          => true,
  397.             'has_archive'         => true,
  398.             'publicly_queryable'  => true,
  399.             'query_var'           => true,
  400.             'rewrite'             => false, //array('slug' => false, 'with_front' => false, 'paged' => false, 'feed' => false),
  401.         ); // ( http://codex.wordpress.org/Function_Reference/register_post_type )
  402.  
  403.     register_post_type('backgrounds', $backgrounds);
  404.  
  405.  
  406.  
  407.     // creating ( registering ) the custom type
  408.     $labels = array(
  409.         'name' => 'Mailings',
  410.         'singular_name' => 'Mailing',
  411.         'all_items' => 'Todos os Mailings',
  412.         'add_new' => 'Adicione um novo',
  413.         'add_new_item' => 'Adicione um novo Mailing',
  414.         'edit' => 'Editar',
  415.         'edit_item' => 'Editar Mailing',
  416.         'new_item' => 'Novo Mailing',
  417.         'view_item' => 'Ver Mailing',
  418.         'search_items' => 'Procurar Mailings',
  419.         'not_found' =>  'Nenhum Mailing encontrado',
  420.         'not_found_in_trash' => 'Nenhum Mailing na lixeira',
  421.         'parent_item_colon' => ''
  422.         );
  423.  
  424.     $mailings = array(
  425.             //'menu_icon'         => get_stylesheet_directory_uri() . '/library/images/custom-post-icon.png', /* the icon for the custom post type menu */
  426.             'label'               => 'maling',
  427.             'description'         => '',
  428.             'labels'              => $labels,
  429.             'supports'            => array('title', 'custom-fields', 'editor'), //, 'author'
  430.             'capability_type'     => 'page',
  431.             'menu_icon'           => 'dashicons-email-alt',
  432.             'exclude_from_search' => true,
  433.             'hierarchical'        => false,
  434.             'public'              => true,
  435.             'show_ui'             => true,
  436.             'show_in_menu'        => true,
  437.             'show_in_nav_menus'   => true,
  438.             'show_in_admin_bar'   => true,
  439.             'menu_position'       => 20,
  440.             'can_export'          => true,
  441.             'has_archive'         => true,
  442.             'publicly_queryable'  => true,
  443.             'query_var'           => true,
  444.             'rewrite'             => true,
  445.         ); // ( http://codex.wordpress.org/Function_Reference/register_post_type )
  446.  
  447.     register_post_type('mailing', $mailings);
  448. }
  449.  
  450. function views_base_pid_cpt_rewrite() {
  451.  
  452.     $post_types = array('projetos');
  453.  
  454.     foreach($post_types as $post_type) {
  455.         // Prevent WordPress from sending a 404
  456.         add_rewrite_rule('([0-9]{4})/projeto/(\d+)/[^/]+/?$', 'index.php?year=$matches[1]&post_type='.$post_type.'&p=$matches[2]', 'top');
  457.         add_rewrite_rule('([0-9]{4})/projeto/(\d+)/[^/]+/[^/]+/?$', 'index.php?year=$matches[1]&post_type='.$post_type.'&p=$matches[2]', 'top');
  458.     }
  459. }
  460.  
  461. function views_base_pid_cpt_rewrite_permalink( $post_link, $id = 0 ) {
  462.  
  463.     $post_types = array('projetos');
  464.  
  465.     // check if post exits and if we hit the cpt slug
  466.     $post = get_post($id);
  467.     if(is_wp_error($post) || !in_array($post->post_type, $post_types))
  468.         return $post_link;
  469.  
  470.     // sanitize slug
  471.     empty($post->slug) and $post->slug = sanitize_title($post->post_title);
  472.  
  473.     if($post->post_parent > 0) {
  474.         $parent = get_post($post->post_parent);
  475.         empty($parent->slug) and $parent->slug = sanitize_title($parent->post_title);
  476.         //empty($post->slug) and $post->slug = sanitize_title($post->post_title);
  477.         return home_url(user_trailingslashit("%year%/projeto/$post->ID/$parent->slug/$post->slug"));
  478.     } else {
  479.         return home_url(user_trailingslashit("%year%/projeto/$post->ID/$post->slug"));
  480.     }
  481.  
  482.     // return the modified url
  483.     //return home_url(user_trailingslashit("$post->post_type/%year%/$post->ID/$post->slug"));
  484.     //return home_url(user_trailingslashit("%year%/$post->post_type/$post->ID/$post->slug"));
  485.  
  486. }
  487.  
  488. function gt_permalink($permalink, $post_id, $leavename) {
  489.     $post = get_post($post_id);
  490.     $rewritecode = array(
  491.         '%year%',
  492.         '%monthnum%',
  493.         '%day%',
  494.         '%hour%',
  495.         '%minute%',
  496.         '%second%',
  497.         $leavename? '' : '%postname%',
  498.         '%post_id%',
  499.         '%category%',
  500.         '%author%',
  501.         $leavename? '' : '%pagename%',
  502.     );
  503.  
  504.     if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) ) {
  505.         $unixtime = strtotime($post->post_date);
  506.  
  507.         $category = '';
  508.         if ( strpos($permalink, '%category%') !== false ) {
  509.             $cats = get_the_category($post->ID);
  510.             if ( $cats ) {
  511.                 usort($cats, '_usort_terms_by_ID'); // order by ID
  512.                 $category = $cats[0]->slug;
  513.                 if ( $parent = $cats[0]->parent )
  514.                     $category = get_category_parents($parent, false, '/', true) . $category;
  515.             }
  516.             // show default category in permalinks, without
  517.             // having to assign it explicitly
  518.             if ( empty($category) ) {
  519.                 $default_category = get_category( get_option( 'default_category' ) );
  520.                 $category = is_wp_error( $default_category ) ? '' : $default_category->slug;
  521.             }
  522.         }
  523.  
  524.         $author = '';
  525.         if ( strpos($permalink, '%author%') !== false ) {
  526.             $authordata = get_userdata($post->post_author);
  527.             $author = $authordata->user_nicename;
  528.         }
  529.  
  530.         $date = explode(" ",date('Y m d H i s', $unixtime));
  531.         $rewritereplace =
  532.         array(
  533.             $date[0],
  534.             $date[1],
  535.             $date[2],
  536.             $date[3],
  537.             $date[4],
  538.             $date[5],
  539.             $post->post_name,
  540.             $post->ID,
  541.             $category,
  542.             $author,
  543.             $post->post_name,
  544.         );
  545.         $permalink = str_replace($rewritecode, $rewritereplace, $permalink);
  546.     } else { // if they're not using the fancy permalink option
  547.     }
  548.     return $permalink;
  549. }
  550.  
  551. function my_remove_menu_pages() {
  552.     remove_menu_page('edit.php');
  553. }
  554.  
  555. add_action('wp_before_admin_bar_render', 'remove_admin_bar_links');
  556. function remove_admin_bar_links() {
  557.     global $wp_admin_bar;
  558.     $wp_admin_bar->remove_menu('new-content');      // Remove the content link
  559. }
  560.  
  561. // Add filter to plugin init function
  562. add_filter('post_type_link', 'gt_permalink', 10, 3);
  563. add_filter('post_type_link', 'views_base_pid_cpt_rewrite_permalink', 1, 3);
  564. add_action('init', 'views_base_pid_cpt_rewrite');
  565. add_action( 'admin_menu', 'my_remove_menu_pages' );
  566.  
  567. function custom_taxonomy_post_class( $classes, $class, $ID ) {
  568.  
  569.     $taxonomy = array('classificacao');
  570.     $terms = get_the_terms( (int) $ID, $taxonomy );
  571.  
  572.     if( !empty( $terms ) ) {
  573.  
  574.         foreach( (array) $terms as $order => $term ) {
  575.  
  576.             if( !in_array( $term->slug, $classes ) ) {
  577.  
  578.                 $classes[] = $term->slug;
  579.             }
  580.         }
  581.     }
  582.  
  583.     return $classes;
  584. }
  585.  
  586. function footer_db_queries() {
  587.     echo '<!-- '.get_num_queries().' queries in '.timer_stop(0).' seconds. -->'.PHP_EOL;
  588. }
  589.  
  590. function vid_sc($atts, $content=null) {
  591.     extract(
  592.         shortcode_atts(array(
  593.             'site' => 'youtube',
  594.             'id' => '',
  595.             'w' => '600',
  596.             'h' => '370'
  597.         ), $atts)
  598.     );
  599.  
  600.     if ( $site == "youtube" ) { $src = 'http://www.youtube.com/embed/' . $id . '?enablejsapi=1&version=3&color=white&modestbranding=1&rel=0&showinfo=0&theme=dark&wmode=transparent&fs=1&controls=2&autohide=1&origin=*&playerapiid=v_' . $id; }
  601.     else if ( $site == "vimeo" ) { $src = 'http://player.vimeo.com/video/'.$id; }
  602.     else if ( $site == "dailymotion" ) { $src = 'http://www.dailymotion.com/embed/video/'.$id; }
  603.     else if ( $site == "yahoo" ) { $src = 'http://d.yimg.com/nl/vyc/site/player.html#vid='.$id; }
  604.     else if ( $site == "bliptv" ) { $src = 'http://a.blip.tv/scripts/shoggplayer.html#file=http://blip.tv/rss/flash/'.$id; }
  605.     else if ( $site == "veoh" ) { $src = 'http://www.veoh.com/static/swf/veoh/SPL.swf?videoAutoPlay=0&permalinkId='.$id; }
  606.     else if ( $site == "viddler" ) { $src = 'http://www.viddler.com/simple/'.$id; }
  607.     if ( $id != '' ) {
  608.         return '<div id="v_' . $id . '" class="embed"><iframe id="i_' . $id . '" src="'.$src.'" class="vid iframe-'.$site.'"></iframe></div>';
  609.     }
  610. }
  611.  
  612. function filter_media_comment_status( $open, $post_id ) {
  613.     $post = get_post( $post_id );
  614.     if( $post->post_type == 'attachment' ) {
  615.         return false;
  616.     }
  617.  
  618.     return $open;
  619. }
  620.  
  621. add_filter( 'comments_open', 'filter_media_comment_status', 10 , 2 );
  622.  
  623. add_filter( 'page_attributes_dropdown_pages_args', 'so_3538267_enable_drafts_parents' );
  624. add_filter( 'quick_edit_dropdown_pages_args', 'so_3538267_enable_drafts_parents' );
  625.  
  626. function so_3538267_enable_drafts_parents( $args ) {
  627.     $args['post_status'] = 'draft,publish,pending';
  628.     return $args;
  629. }
  630.  
  631. if(function_exists("register_field_group")) {
  632.     //define( 'ACF_LITE', true );
  633.  
  634.     register_field_group(array (
  635.         'id' => 'acf_linha-do-tempo',
  636.         'title' => 'Linha do Tempo',
  637.         'fields' => array (
  638.             array (
  639.                 'key' => 'field_52e3dd03acc06',
  640.                 'label' => 'Status',
  641.                 'name' => 'status',
  642.                 'type' => 'select',
  643.                 'choices' => array (
  644.                     1 => 'Em andamento',
  645.                     2 => 'Pausado',
  646.                     3 => 'Concluído',
  647.                 ),
  648.                 'default_value' => '',
  649.                 'allow_null' => 0,
  650.                 'multiple' => 0,
  651.             ),
  652.             array (
  653.                 'key' => 'field_52e3dd0324c06',
  654.                 'label' => 'Ordenação',
  655.                 'name' => 'ordenacao',
  656.                 'type' => 'true_false',
  657.                 'column_width' => '',
  658.                 'message' => 'Habilitar ordem manual dos itens',
  659.                 'default_value' => 0,
  660.             ),
  661.             array (
  662.                 'key' => 'field_52e3dd03aa405',
  663.                 'label' => 'Acontecimentos',
  664.                 'name' => 'acontecimentos',
  665.                 'type' => 'flexible_content',
  666.                 'layouts' => array (
  667.                     array (
  668.                         'label' => 'Galeria',
  669.                         'name' => 'galeria',
  670.                         'display' => 'row',
  671.                         'min' => '',
  672.                         'max' => '',
  673.                         'sub_fields' => array (
  674.                             array (
  675.                                 'key' => 'field_52e2fd9c809fe',
  676.                                 'label' => 'Título',
  677.                                 'name' => 'titulo',
  678.                                 'type' => 'text',
  679.                                 'column_width' => '',
  680.                                 'default_value' => '',
  681.                                 'placeholder' => '',
  682.                                 'prepend' => '',
  683.                                 'append' => '',
  684.                                 'formatting' => 'html',
  685.                                 'maxlength' => '',
  686.                             ),
  687.                             array (
  688.                                 'key' => 'field_52fe29f92b7bf',
  689.                                 'label' => 'Privado',
  690.                                 'name' => 'privado',
  691.                                 'type' => 'true_false',
  692.                                 'column_width' => '',
  693.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  694.                                 'default_value' => 1,
  695.                             ),
  696.                             array (
  697.                                 'key' => 'field_52e2fd78809fd',
  698.                                 'label' => 'Data',
  699.                                 'name' => 'data',
  700.                                 'type' => 'date_picker',
  701.                                 'required' => 1,
  702.                                 'column_width' => '',
  703.                                 'date_format' => 'yymmdd',
  704.                                 'display_format' => 'dd/mm/yy',
  705.                                 'first_day' => 1,
  706.                             ),
  707.                             array (
  708.                                 'key' => 'field_52e3003d73f21',
  709.                                 'label' => 'Imagens',
  710.                                 'name' => 'imagens',
  711.                                 'type' => 'gallery',
  712.                                 'column_width' => '',
  713.                                 'preview_size' => 'mini',
  714.                                 'library' => 'all',
  715.                             ),
  716.                             array (
  717.                                 'key' => 'field_52e2fdaf809ff',
  718.                                 'label' => 'Texto',
  719.                                 'name' => 'texto',
  720.                                 'type' => 'wysiwyg',
  721.                                 'column_width' => '',
  722.                                 'default_value' => '',
  723.                                 'toolbar' => 'basic',
  724.                                 'media_upload' => 'yes',
  725.                             ),
  726.                         ),
  727.                     ),
  728.                     array (
  729.                         'label' => 'Imagem',
  730.                         'name' => 'imagem',
  731.                         'display' => 'row',
  732.                         'min' => '',
  733.                         'max' => '',
  734.                         'sub_fields' => array (
  735.                             array (
  736.                                 'key' => 'field_52e2fe0f0cc3f',
  737.                                 'label' => 'Título',
  738.                                 'name' => 'titulo',
  739.                                 'type' => 'text',
  740.                                 'column_width' => '',
  741.                                 'default_value' => '',
  742.                                 'placeholder' => '',
  743.                                 'prepend' => '',
  744.                                 'append' => '',
  745.                                 'formatting' => 'html',
  746.                                 'maxlength' => '',
  747.                             ),
  748.                             array (
  749.                                 'key' => 'field_52fe2a68c2164',
  750.                                 'label' => 'Privado',
  751.                                 'name' => 'privado',
  752.                                 'type' => 'true_false',
  753.                                 'column_width' => '',
  754.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  755.                                 'default_value' => 1,
  756.                             ),
  757.                             array (
  758.                                 'key' => 'field_52e2fe0f0cc40',
  759.                                 'label' => 'Data',
  760.                                 'name' => 'data',
  761.                                 'type' => 'date_picker',
  762.                                 'required' => 1,
  763.                                 'column_width' => '',
  764.                                 'date_format' => 'yymmdd',
  765.                                 'display_format' => 'dd/mm/yy',
  766.                                 'first_day' => 1,
  767.                             ),
  768.                             array (
  769.                                 'key' => 'field_52e3006b73f22',
  770.                                 'label' => 'Imagem',
  771.                                 'name' => 'imagem',
  772.                                 'type' => 'image',
  773.                                 'column_width' => '',
  774.                                 'save_format' => 'object',
  775.                                 'preview_size' => 'mini',
  776.                                 'library' => 'all',
  777.                             ),
  778.                             array (
  779.                                 'key' => 'field_52e2fe0f0cc41',
  780.                                 'label' => 'Texto',
  781.                                 'name' => 'texto',
  782.                                 'type' => 'wysiwyg',
  783.                                 'column_width' => '',
  784.                                 'default_value' => '',
  785.                                 'toolbar' => 'basic',
  786.                                 'media_upload' => 'yes',
  787.                             ),
  788.                         ),
  789.                     ),
  790.                     array (
  791.                         'label' => 'Video',
  792.                         'name' => 'video',
  793.                         'display' => 'row',
  794.                         'min' => '',
  795.                         'max' => '',
  796.                         'sub_fields' => array (
  797.                             array (
  798.                                 'key' => 'field_52e2fe480cc43',
  799.                                 'label' => 'Título',
  800.                                 'name' => 'titulo',
  801.                                 'type' => 'text',
  802.                                 'column_width' => '',
  803.                                 'default_value' => '',
  804.                                 'placeholder' => '',
  805.                                 'prepend' => '',
  806.                                 'append' => '',
  807.                                 'formatting' => 'html',
  808.                                 'maxlength' => '',
  809.                             ),
  810.                             array (
  811.                                 'key' => 'field_52fe2a7bc2165',
  812.                                 'label' => 'Privado',
  813.                                 'name' => 'privado',
  814.                                 'type' => 'true_false',
  815.                                 'column_width' => '',
  816.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  817.                                 'default_value' => 1,
  818.                             ),
  819.                             array (
  820.                                 'key' => 'field_52e2fe480cc44',
  821.                                 'label' => 'Data',
  822.                                 'name' => 'data',
  823.                                 'type' => 'date_picker',
  824.                                 'required' => 1,
  825.                                 'column_width' => '',
  826.                                 'date_format' => 'yymmdd',
  827.                                 'display_format' => 'dd/mm/yy',
  828.                                 'first_day' => 1,
  829.                             ),
  830.                             array (
  831.                                 'key' => 'field_52e3008473f23',
  832.                                 'label' => 'Código',
  833.                                 'name' => 'codigo',
  834.                                 'type' => 'text',
  835.                                 'column_width' => '',
  836.                                 'default_value' => '',
  837.                                 'placeholder' => '',
  838.                                 'prepend' => '',
  839.                                 'append' => '',
  840.                                 'formatting' => 'html',
  841.                                 'maxlength' => '',
  842.                             ),
  843.                             array (
  844.                                 'key' => 'field_52e2fe480cc45',
  845.                                 'label' => 'Texto',
  846.                                 'name' => 'texto',
  847.                                 'type' => 'wysiwyg',
  848.                                 'column_width' => '',
  849.                                 'default_value' => '',
  850.                                 'toolbar' => 'basic',
  851.                                 'media_upload' => 'yes',
  852.                             ),
  853.                         ),
  854.                     ),
  855.                     array (
  856.                         'label' => 'Áudio',
  857.                         'name' => 'audio',
  858.                         'display' => 'row',
  859.                         'min' => '',
  860.                         'max' => '',
  861.                         'sub_fields' => array (
  862.                             array (
  863.                                 'key' => 'field_52e2fe520cc47',
  864.                                 'label' => 'Título',
  865.                                 'name' => 'titulo',
  866.                                 'type' => 'text',
  867.                                 'column_width' => '',
  868.                                 'default_value' => '',
  869.                                 'placeholder' => '',
  870.                                 'prepend' => '',
  871.                                 'append' => '',
  872.                                 'formatting' => 'html',
  873.                                 'maxlength' => '',
  874.                             ),
  875.                             array (
  876.                                 'key' => 'field_52fe2a91c2166',
  877.                                 'label' => 'Privado',
  878.                                 'name' => 'privado',
  879.                                 'type' => 'true_false',
  880.                                 'column_width' => '',
  881.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  882.                                 'default_value' => 1,
  883.                             ),
  884.                             array (
  885.                                 'key' => 'field_52e2fe520cc48',
  886.                                 'label' => 'Data',
  887.                                 'name' => 'data',
  888.                                 'type' => 'date_picker',
  889.                                 'required' => 1,
  890.                                 'column_width' => '',
  891.                                 'date_format' => 'yymmdd',
  892.                                 'display_format' => 'dd/mm/yy',
  893.                                 'first_day' => 1,
  894.                             ),
  895.                             array (
  896.                                 'key' => 'field_52e2fe520cc49',
  897.                                 'label' => 'Texto',
  898.                                 'name' => 'texto',
  899.                                 'type' => 'wysiwyg',
  900.                                 'column_width' => '',
  901.                                 'default_value' => '',
  902.                                 'toolbar' => 'basic',
  903.                                 'media_upload' => 'yes',
  904.                             ),
  905.                             array (
  906.                                 'key' => 'field_52e3009c73f24',
  907.                                 'label' => 'Arquivo',
  908.                                 'name' => 'arquivo',
  909.                                 'type' => 'file',
  910.                                 'column_width' => '',
  911.                                 'save_format' => 'object',
  912.                                 'library' => 'all',
  913.                             ),
  914.                         ),
  915.                     ),
  916.  
  917.                     array (
  918.                         'label' => 'Artigo',
  919.                         'name' => 'artigo',
  920.                         'display' => 'row',
  921.                         'min' => '',
  922.                         'max' => '',
  923.                         'sub_fields' => array (
  924.                             array (
  925.                                 'key' => 'field_52e2fe5c0244b',
  926.                                 'label' => 'Título',
  927.                                 'name' => 'titulo',
  928.                                 'type' => 'text',
  929.                                 'column_width' => '',
  930.                                 'default_value' => '',
  931.                                 'placeholder' => '',
  932.                                 'prepend' => '',
  933.                                 'append' => '',
  934.                                 'formatting' => 'html',
  935.                                 'maxlength' => '',
  936.                             ),
  937.                             array (
  938.                                 'key' => 'field_52fe2aa2c2247',
  939.                                 'label' => 'Privado',
  940.                                 'name' => 'privado',
  941.                                 'type' => 'true_false',
  942.                                 'column_width' => '',
  943.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  944.                                 'default_value' => 1,
  945.                             ),
  946.                             array (
  947.                                 'key' => 'field_52e2fe5c24c4c',
  948.                                 'label' => 'Data',
  949.                                 'name' => 'data',
  950.                                 'type' => 'date_picker',
  951.                                 'required' => 1,
  952.                                 'column_width' => '',
  953.                                 'date_format' => 'yymmdd',
  954.                                 'display_format' => 'dd/mm/yy',
  955.                                 'first_day' => 1,
  956.                             ),
  957.                             array (
  958.                                 'key' => 'field_52e2fe5c0cc4d',
  959.                                 'label' => 'Texto',
  960.                                 'name' => 'texto',
  961.                                 'type' => 'wysiwyg',
  962.                                 'column_width' => '',
  963.                                 'default_value' => '',
  964.                                 'toolbar' => 'full',
  965.                                 'media_upload' => 'yes',
  966.                             ),
  967.                         ),
  968.                     ),
  969.                     array (
  970.                         'label' => 'E-mail',
  971.                         'name' => 'email',
  972.                         'display' => 'row',
  973.                         'min' => '',
  974.                         'max' => '',
  975.                         'sub_fields' => array (
  976.                             array (
  977.                                 'key' => 'field_52e2fe5c0cc4b',
  978.                                 'label' => 'Título',
  979.                                 'name' => 'titulo',
  980.                                 'type' => 'text',
  981.                                 'column_width' => '',
  982.                                 'default_value' => '',
  983.                                 'placeholder' => '',
  984.                                 'prepend' => '',
  985.                                 'append' => '',
  986.                                 'formatting' => 'html',
  987.                                 'maxlength' => '',
  988.                             ),
  989.                             array (
  990.                                 'key' => 'field_52fe2aa2c2167',
  991.                                 'label' => 'Privado',
  992.                                 'name' => 'privado',
  993.                                 'type' => 'true_false',
  994.                                 'column_width' => '',
  995.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  996.                                 'default_value' => 1,
  997.                             ),
  998.                             array (
  999.                                 'key' => 'field_52e2fe5c0cc4c',
  1000.                                 'label' => 'Data',
  1001.                                 'name' => 'data',
  1002.                                 'type' => 'date_picker',
  1003.                                 'required' => 1,
  1004.                                 'column_width' => '',
  1005.                                 'date_format' => 'yymmdd',
  1006.                                 'display_format' => 'dd/mm/yy',
  1007.                                 'first_day' => 1,
  1008.                             ),
  1009.                             array (
  1010.                                 'key' => 'field_52e2fe524cc4d',
  1011.                                 'label' => 'Texto',
  1012.                                 'name' => 'texto',
  1013.                                 'type' => 'wysiwyg',
  1014.                                 'column_width' => '',
  1015.                                 'default_value' => '',
  1016.                                 'toolbar' => 'full',
  1017.                                 'media_upload' => 'yes',
  1018.                             ),
  1019.                         ),
  1020.                     ),
  1021.                     array (
  1022.                         'label' => 'Press Release',
  1023.                         'name' => 'press_release',
  1024.                         'display' => 'row',
  1025.                         'min' => '',
  1026.                         'max' => '',
  1027.                         'sub_fields' => array (
  1028.                             array (
  1029.                                 'key' => 'field_52e2fe6a0cc4f',
  1030.                                 'label' => 'Título',
  1031.                                 'name' => 'titulo',
  1032.                                 'type' => 'text',
  1033.                                 'column_width' => '',
  1034.                                 'default_value' => '',
  1035.                                 'placeholder' => '',
  1036.                                 'prepend' => '',
  1037.                                 'append' => '',
  1038.                                 'formatting' => 'html',
  1039.                                 'maxlength' => '',
  1040.                             ),
  1041.                             array (
  1042.                                 'key' => 'field_52fe2abbdb664',
  1043.                                 'label' => 'Privado',
  1044.                                 'name' => 'privado',
  1045.                                 'type' => 'true_false',
  1046.                                 'column_width' => '',
  1047.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  1048.                                 'default_value' => 1,
  1049.                             ),
  1050.                             array (
  1051.                                 'key' => 'field_52e2fe6a0cc50',
  1052.                                 'label' => 'Data',
  1053.                                 'name' => 'data',
  1054.                                 'type' => 'date_picker',
  1055.                                 'required' => 1,
  1056.                                 'column_width' => '',
  1057.                                 'date_format' => 'yymmdd',
  1058.                                 'display_format' => 'dd/mm/yy',
  1059.                                 'first_day' => 1,
  1060.                             ),
  1061.                             array (
  1062.                                 'key' => 'field_52e2fe6a0cc51',
  1063.                                 'label' => 'Texto',
  1064.                                 'name' => 'texto',
  1065.                                 'type' => 'wysiwyg',
  1066.                                 'column_width' => '',
  1067.                                 'default_value' => '',
  1068.                                 'toolbar' => 'full',
  1069.                                 'media_upload' => 'yes',
  1070.                             ),
  1071.                         ),
  1072.                     ),
  1073.                     array (
  1074.                         'label' => 'Link',
  1075.                         'name' => 'link',
  1076.                         'display' => 'row',
  1077.                         'min' => '',
  1078.                         'max' => '',
  1079.                         'sub_fields' => array (
  1080.                             array (
  1081.                                 'key' => 'field_52e2fe750cc53',
  1082.                                 'label' => 'Título',
  1083.                                 'name' => 'titulo',
  1084.                                 'type' => 'text',
  1085.                                 'column_width' => '',
  1086.                                 'default_value' => '',
  1087.                                 'placeholder' => '',
  1088.                                 'prepend' => '',
  1089.                                 'append' => '',
  1090.                                 'formatting' => 'html',
  1091.                                 'maxlength' => '',
  1092.                             ),
  1093.                             array (
  1094.                                 'key' => 'field_52fe2ae1db665',
  1095.                                 'label' => 'Privado',
  1096.                                 'name' => 'privado',
  1097.                                 'type' => 'true_false',
  1098.                                 'column_width' => '',
  1099.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  1100.                                 'default_value' => 1,
  1101.                             ),
  1102.                             array (
  1103.                                 'key' => 'field_52e2fe750cc54',
  1104.                                 'label' => 'Data',
  1105.                                 'name' => 'data',
  1106.                                 'type' => 'date_picker',
  1107.                                 'required' => 1,
  1108.                                 'column_width' => '',
  1109.                                 'date_format' => 'yymmdd',
  1110.                                 'display_format' => 'dd/mm/yy',
  1111.                                 'first_day' => 1,
  1112.                             ),
  1113.                             array (
  1114.                                 'key' => 'field_52e2fe750cc55',
  1115.                                 'label' => 'Texto',
  1116.                                 'name' => 'texto',
  1117.                                 'type' => 'wysiwyg',
  1118.                                 'column_width' => '',
  1119.                                 'default_value' => '',
  1120.                                 'toolbar' => 'basic',
  1121.                                 'media_upload' => 'yes',
  1122.                             ),
  1123.                         ),
  1124.                     ),
  1125.                     array (
  1126.                         'label' => 'Arquivo',
  1127.                         'name' => 'arquivo',
  1128.                         'display' => 'row',
  1129.                         'min' => '',
  1130.                         'max' => '',
  1131.                         'sub_fields' => array (
  1132.                             array (
  1133.                                 'key' => 'field_52e2fe7e0cc57',
  1134.                                 'label' => 'Título',
  1135.                                 'name' => 'titulo',
  1136.                                 'type' => 'text',
  1137.                                 'column_width' => '',
  1138.                                 'default_value' => '',
  1139.                                 'placeholder' => '',
  1140.                                 'prepend' => '',
  1141.                                 'append' => '',
  1142.                                 'formatting' => 'html',
  1143.                                 'maxlength' => '',
  1144.                             ),
  1145.                             array (
  1146.                                 'key' => 'field_52fe2aefdb666',
  1147.                                 'label' => 'Privado',
  1148.                                 'name' => 'privado',
  1149.                                 'type' => 'true_false',
  1150.                                 'column_width' => '',
  1151.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  1152.                                 'default_value' => 1,
  1153.                             ),
  1154.                             array (
  1155.                                 'key' => 'field_52e2fe7e0cc58',
  1156.                                 'label' => 'Data',
  1157.                                 'name' => 'data',
  1158.                                 'type' => 'date_picker',
  1159.                                 'required' => 1,
  1160.                                 'column_width' => '',
  1161.                                 'date_format' => 'yymmdd',
  1162.                                 'display_format' => 'dd/mm/yy',
  1163.                                 'first_day' => 1,
  1164.                             ),
  1165.                             array (
  1166.                                 'key' => 'field_52e2fe7e0cc59',
  1167.                                 'label' => 'Texto',
  1168.                                 'name' => 'texto',
  1169.                                 'type' => 'wysiwyg',
  1170.                                 'column_width' => '',
  1171.                                 'default_value' => '',
  1172.                                 'toolbar' => 'basic',
  1173.                                 'media_upload' => 'yes',
  1174.                             ),
  1175.                         ),
  1176.                     ),
  1177.                     array (
  1178.                         'label' => 'Contrato',
  1179.                         'name' => 'contrato',
  1180.                         'display' => 'row',
  1181.                         'min' => '',
  1182.                         'max' => '',
  1183.                         'sub_fields' => array (
  1184.                             array (
  1185.                                 'key' => 'field_530278dc10ea3',
  1186.                                 'label' => 'Título',
  1187.                                 'name' => 'titulo',
  1188.                                 'type' => 'text',
  1189.                                 'column_width' => '',
  1190.                                 'default_value' => '',
  1191.                                 'placeholder' => '',
  1192.                                 'prepend' => '',
  1193.                                 'append' => '',
  1194.                                 'formatting' => 'html',
  1195.                                 'maxlength' => '',
  1196.                             ),
  1197.                             array (
  1198.                                 'key' => 'field_530278dc10ea4',
  1199.                                 'label' => 'Privado',
  1200.                                 'name' => 'privado',
  1201.                                 'type' => 'true_false',
  1202.                                 'column_width' => '',
  1203.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  1204.                                 'default_value' => 1,
  1205.                             ),
  1206.                             array (
  1207.                                 'key' => 'field_530278dc10ea5',
  1208.                                 'label' => 'Data',
  1209.                                 'name' => 'data',
  1210.                                 'type' => 'date_picker',
  1211.                                 'required' => 1,
  1212.                                 'column_width' => '',
  1213.                                 'date_format' => 'yymmdd',
  1214.                                 'display_format' => 'dd/mm/yy',
  1215.                                 'first_day' => 1,
  1216.                             ),
  1217.                             array (
  1218.                                 'key' => 'field_530278dc10ea6',
  1219.                                 'label' => 'Texto',
  1220.                                 'name' => 'texto',
  1221.                                 'type' => 'wysiwyg',
  1222.                                 'column_width' => '',
  1223.                                 'default_value' => '',
  1224.                                 'toolbar' => 'basic',
  1225.                                 'media_upload' => 'yes',
  1226.                             ),
  1227.                         ),
  1228.                     ),
  1229.                     array (
  1230.                         'label' => 'Citação',
  1231.                         'name' => 'citacao',
  1232.                         'display' => 'row',
  1233.                         'min' => '',
  1234.                         'max' => '',
  1235.                         'sub_fields' => array (
  1236.                             array (
  1237.                                 'key' => 'field_52e2fe880cc5b',
  1238.                                 'label' => 'Título',
  1239.                                 'name' => 'titulo',
  1240.                                 'type' => 'text',
  1241.                                 'column_width' => '',
  1242.                                 'default_value' => '',
  1243.                                 'placeholder' => '',
  1244.                                 'prepend' => '',
  1245.                                 'append' => '',
  1246.                                 'formatting' => 'html',
  1247.                                 'maxlength' => '',
  1248.                             ),
  1249.                             array (
  1250.                                 'key' => 'field_52fe2afcdb667',
  1251.                                 'label' => 'Privado',
  1252.                                 'name' => 'privado',
  1253.                                 'type' => 'true_false',
  1254.                                 'column_width' => '',
  1255.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  1256.                                 'default_value' => 1,
  1257.                             ),
  1258.                             array (
  1259.                                 'key' => 'field_52e2fe880cc5c',
  1260.                                 'label' => 'Data',
  1261.                                 'name' => 'data',
  1262.                                 'type' => 'date_picker',
  1263.                                 'required' => 1,
  1264.                                 'column_width' => '',
  1265.                                 'date_format' => 'yymmdd',
  1266.                                 'display_format' => 'dd/mm/yy',
  1267.                                 'first_day' => 1,
  1268.                             ),
  1269.                             array (
  1270.                                 'key' => 'field_52e2fe880cc5d',
  1271.                                 'label' => 'Texto',
  1272.                                 'name' => 'texto',
  1273.                                 'type' => 'wysiwyg',
  1274.                                 'column_width' => '',
  1275.                                 'default_value' => '',
  1276.                                 'toolbar' => 'full',
  1277.                                 'media_upload' => 'yes',
  1278.                             ),
  1279.                         ),
  1280.                     ),
  1281.                     array (
  1282.                         'label' => 'Localização',
  1283.                         'name' => 'localizacao',
  1284.                         'display' => 'row',
  1285.                         'min' => '',
  1286.                         'max' => '',
  1287.                         'sub_fields' => array (
  1288.                             array (
  1289.                                 'key' => 'field_52e2fe910cc5f',
  1290.                                 'label' => 'Título',
  1291.                                 'name' => 'titulo',
  1292.                                 'type' => 'text',
  1293.                                 'column_width' => '',
  1294.                                 'default_value' => '',
  1295.                                 'placeholder' => '',
  1296.                                 'prepend' => '',
  1297.                                 'append' => '',
  1298.                                 'formatting' => 'html',
  1299.                                 'maxlength' => '',
  1300.                             ),
  1301.                             array (
  1302.                                 'key' => 'field_52fe2b0adb668',
  1303.                                 'label' => 'Privado',
  1304.                                 'name' => 'privado',
  1305.                                 'type' => 'true_false',
  1306.                                 'column_width' => '',
  1307.                                 'message' => 'Ocultar conteúdo para usuários não logados',
  1308.                                 'default_value' => 1,
  1309.                             ),
  1310.                             array (
  1311.                                 'key' => 'field_52e2fe910cc60',
  1312.                                 'label' => 'Data',
  1313.                                 'name' => 'data',
  1314.                                 'type' => 'date_picker',
  1315.                                 'required' => 1,
  1316.                                 'column_width' => '',
  1317.                                 'date_format' => 'yymmdd',
  1318.                                 'display_format' => 'dd/mm/yy',
  1319.                                 'first_day' => 1,
  1320.                             ),
  1321.                             array (
  1322.                                 'key' => 'field_52eaa7b901cd0',
  1323.                                 'label' => 'Link',
  1324.                                 'name' => 'link',
  1325.                                 'type' => 'text',
  1326.                                 'column_width' => '',
  1327.                                 'default_value' => '',
  1328.                                 'placeholder' => '',
  1329.                                 'prepend' => '',
  1330.                                 'append' => '',
  1331.                                 'formatting' => 'html',
  1332.                                 'maxlength' => '',
  1333.                             ),
  1334.                             array (
  1335.                                 'key' => 'field_52e3ed02672f8',
  1336.                                 'label' => 'Mapa',
  1337.                                 'name' => 'mapa',
  1338.                                 'type' => 'google_map',
  1339.                                 'column_width' => '',
  1340.                                 'center_lat' => '-17.9335027',
  1341.                                 'center_lng' => '-53.0159668',
  1342.                                 'zoom' => 6,
  1343.                                 'height' => '',
  1344.                             ),
  1345.                             array (
  1346.                                 'key' => 'field_52e2fe910cc61',
  1347.                                 'label' => 'Texto',
  1348.                                 'name' => 'texto',
  1349.                                 'type' => 'wysiwyg',
  1350.                                 'column_width' => '',
  1351.                                 'default_value' => '',
  1352.                                 'toolbar' => 'basic',
  1353.                                 'media_upload' => 'yes',
  1354.                             ),
  1355.                         ),
  1356.                     ),
  1357.                 ),
  1358.                 'min' => '',
  1359.                 'max' => '',
  1360.                 'button_label' => 'Add Row',
  1361.             ),
  1362.         ),
  1363.         'location' => array (
  1364.             array (
  1365.                 array (
  1366.                     'param' => 'post_type',
  1367.                     'operator' => '==',
  1368.                     'value' => 'projetos',
  1369.                     'order_no' => 0,
  1370.                     'group_no' => 0,
  1371.                 ),
  1372.             ),
  1373.         ),
  1374.         'options' => array (
  1375.             'position' => 'normal',
  1376.             'layout' => 'default',
  1377.             'hide_on_screen' => array (
  1378.                 0 => 'excerpt',
  1379.                 1 => 'custom_fields',
  1380.             ),
  1381.         ),
  1382.         'menu_order' => 2,
  1383.     ));
  1384. }
  1385.  
  1386. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement