document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. functions.php
  2.  
  3. <?php
  4. define('DISALLOW_FILE_EDIT', true);
  5. add_theme_support( 'post-thumbnails' );
  6. wp_enqueue_script("jquery");
  7. /* WIDGETS */
  8. if (function_exists('register_sidebar'))
  9. {
  10. register_sidebar(array(
  11. 'name' => 'Sidebar',
  12. 'before_widget' => '<div class="widget">',
  13. 'after_widget' => '</div>',
  14. 'before_title' => '<h3>',
  15. 'after_title' => '</h3>',
  16. ));
  17. }
  18. if ( function_exists('register_sidebar') ){
  19. register_sidebar(array(
  20. 'name' => 'meu_menu',
  21. 'before_widget' => '<div id="meu-menu-widget">',
  22. 'after_widget' => '</div>',
  23. 'before_title' => '',
  24. 'after_title' => '',
  25. ));
  26. }
  27.  
  28. register_nav_menu( 'main-menu', 'Menu Principal' );
  29. function getAuthors() {
  30. global $wpdb;
  31. $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users ORDER BY display_name");
  32. return $authors;
  33. }
  34. function fb_mce_external_languages($initArray){
  35. $initArray['spellchecker_languages'] = '+Portuguese=pt, English=en';
  36.  
  37. return $initArray;
  38. }
  39. add_filter('tiny_mce_before_init', 'fb_mce_external_languages');
  40. // AQUI REMOVE A VERSÃODO WORDPRESS
  41. remove_action('wp_head', 'wp_generator');
  42. function remove_generator_filter() { return ''; }
  43.  
  44. if (function_exists('add_filter')) {
  45. $types = array('html', 'xhtml', 'atom', 'rss2', /*'rdf',*/ 'comment', 'export');
  46.  
  47. foreach ($types as $type)
  48. add_filter('get_the_generator_'.$type, 'remove_generator_filter');
  49. }
  50.  
  51. // AQUI REMOVE A LOGO DO WP DO BACK-END
  52. function login_enqueue_scripts(){
  53. echo '
  54. <div class="background-cover"></div>
  55. <style type="text/css" media="screen">
  56. .background-cover{
  57. background:url('.get_bloginfo('template_directory').'/images/loginbg.jpg) no-repeat center center fixed;
  58. -webkit-background-size: cover;
  59. -moz-background-size: cover;
  60. -o-background-size: cover;
  61. background-size: cover;
  62. position:fixed;
  63. top:0;
  64. left:0;
  65. z-index:10;
  66. overflow: hidden;
  67. width: 100%;
  68. height:100%;
  69. }
  70. #login{ z-index:9999; position:relative; }
  71. .login form { box-shadow: 0px 0px 0px 0px !important; }
  72. .login h1 a { }
  73. input.button-primary, button.button-primary, a.button-primary{
  74. border-radius: 3px !important; background:#333;
  75. border:none !important;
  76. font-weight:normal !important;
  77. text-shadow:none !important;
  78. }
  79. .button:active, .submit input:active, .button-secondary:active {
  80. background:#96C800 !important;
  81. text-shadow: none !important;
  82. }
  83. .login #nav a, .login #backtoblog a {
  84. color:#fff !important;
  85. text-shadow: none !important;
  86. }
  87. .login #nav a:hover, .login #backtoblog a:hover{
  88. color:#96C800 !important;
  89. text-shadow: none !important;
  90. }
  91. .login #nav, .login #backtoblog{
  92. text-shadow: none !important;
  93. }
  94. </style>
  95. ';
  96. }
  97. add_action( 'login_enqueue_scripts', 'login_enqueue_scripts' );
  98.  
  99. function cutom_login_logo() {
  100. echo "<style type=\\"text/css\\">
  101. body.login div#login h1 a {
  102. background-image: url(".get_bloginfo('template_directory')."/images/logowpadmin.png);
  103. -webkit-background-size: auto;
  104. background-size: auto;
  105. margin: 0 0 0px;
  106. width: 320px;
  107. height: 107px;
  108. }
  109. </style>";
  110. }
  111.  
  112. add_action( 'login_enqueue_scripts', 'cutom_login_logo' );
  113. function loginpage_custom_link() {
  114. return get_bloginfo('url');
  115. }
  116. add_filter('login_headerurl','loginpage_custom_link');
  117.  
  118. function change_title_on_logo() {
  119. return 'Voltar para ' . get_bloginfo('name');
  120. }
  121. add_filter('login_headertitle', 'change_title_on_logo');
  122.  
  123. add_action( 'admin_bar_menu', 'remove_wp_logo', 999 );
  124. function remove_wp_logo( $wp_admin_bar ) {
  125. $wp_admin_bar->remove_node( 'wp-logo' );
  126. }
  127. // AQUI REMOVE A AJUDA DO WP DO BACK-END
  128. add_filter( 'contextual_help', 'mytheme_remove_help_tabs', 999, 3 );
  129. function mytheme_remove_help_tabs($old_help, $screen_id, $screen){
  130. $screen->remove_help_tabs();
  131. return $old_help;
  132. }
  133. // ALTERANDO AUTOR NO PAINEL
  134. function remove_footer_admin () {
  135. echo 'Desenvolvido pela Agência 7 Cores';
  136. }
  137. add_filter('admin_footer_text', 'remove_footer_admin');
  138.  
  139.  
  140. // AQUI COMEÇA O CUSTOM TORNEIOS PROFISSIONAIS QUADRAS
  141. add_action('init', 'create_post_type');
  142. function create_post_type() {
  143.  
  144. register_post_type('profissional', array(
  145. 'labels' => array(
  146. 'name' => __('Profissionais'),
  147. 'singular_name' => __('Profissional')
  148. ),
  149. 'public' => true,
  150. 'has_archive' => false,
  151. 'exclude_from_search' => true,
  152. 'rewrite' => array('slug' => 'profissionais')
  153. )
  154. );
  155.  
  156. register_post_type('calendario', array(
  157. 'labels' => array(
  158. 'name' => __('Calendarios'),
  159. 'singular_name' => __('Calendario')
  160. ),
  161. 'public' => true,
  162. 'has_archive' => false,
  163. 'exclude_from_search' => true,
  164. 'rewrite' => array('slug' => 'caledarios')
  165. )
  166. );
  167.  
  168. register_post_type('ranking', array(
  169. 'labels' => array(
  170. 'name' => __('Rankings'),
  171. 'singular_name' => __('Ranking')
  172. ),
  173. 'public' => true,
  174. 'has_archive' => false,
  175. 'exclude_from_search' => true,
  176. 'rewrite' => array('slug' => 'rankings')
  177. )
  178. );
  179.  
  180.  
  181. // AQUI TERMINA O CUSTOM TORNEIOS PROFISSIONAIS QUADRAS
  182. }
  183. //ADICIONANDO REGISTER POST TYPES QUADRAS
  184. add_action('init', 'type_post_quadra');
  185.  
  186. function type_post_quadra() {
  187. $labels = array(
  188. 'name' => _x('Quadra', 'post type general name'),
  189. 'singular_name' => _x('Quadra', 'post type singular name'),
  190. 'add_new' => _x('Adicionar Novo', 'Novo item'),
  191. 'add_new_item' => __('Novo Item'),
  192. 'edit_item' => __('Editar Item'),
  193. 'new_item' => __('Novo Item'),
  194. 'view_item' => __('Ver Item'),
  195. 'search_items' => __('Procurar Itens'),
  196. 'not_found' => __('Nenhum registro encontrado'),
  197. 'not_found_in_trash' => __('Nenhum registro encontrado na lixeira'),
  198. 'parent_item_colon' => '',
  199. 'menu_name' => 'Quadras'
  200. );
  201.  
  202. $args = array(
  203. 'labels' => $labels,
  204. 'public' => true,
  205. 'public_queryable' => true,
  206. 'show_ui' => true,
  207. 'query_var' => true,
  208. 'rewrite' => true,
  209. 'capability_type' => 'post',
  210. 'has_archive' => true,
  211. 'hierarchical' => false,
  212. 'menu_position' => null,
  213. 'supports' => array('title','editor','thumbnail','comments', 'excerpt', 'custom-fields', 'revisions', 'trackbacks')
  214. );
  215.  
  216. register_post_type( 'quadra' , $args );
  217. flush_rewrite_rules();
  218. }
  219. function criar_taxonomia_tipo(){
  220. register_taxonomy(
  221. 'tipo',
  222. array('post','quadra','profissional'),
  223. array(
  224. 'hierarchical' => true,
  225. 'label' => 'Tipo',
  226. 'query_var' => true,
  227. 'rewrite' => true
  228. )
  229. );
  230. }
  231.  
  232. function criar_taxonomia_cidade(){
  233. register_taxonomy(
  234. 'cidade',
  235. array('post','quadra','profissional'),
  236. array(
  237. 'hierarchical' => true,
  238. 'label' => 'Cidade',
  239. 'query_var' => true,
  240. 'rewrite' => true
  241. )
  242. );
  243. }
  244. function criar_taxonomia_regiao(){
  245. register_taxonomy(
  246. 'regiao',
  247. array('post','quadra','profissional'),
  248. array(
  249. 'hierarchical' => true,
  250. 'label' => 'Região',
  251. 'query_var' => true,
  252. 'rewrite' => true
  253. )
  254. );
  255. }
  256. add_action( 'init', 'criar_taxonomia_tipo' );
  257. add_action( 'init', 'criar_taxonomia_cidade' );
  258. add_action( 'init', 'criar_taxonomia_regiao' );
  259.  
  260. function SearchFilter($query) {
  261.  
  262. if ($query->is_search && $query->is_main_query() && ! is_admin() ) {
  263. }
  264. return $query;
  265. }
  266. // This filter will jump into the loop and arrange our results before they're returned
  267. add_filter('pre_get_posts','SearchFilter');
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275. function pre_get_posts($query) {
  276. if ( $query->is_main_query() && ! is_admin() ) {
  277. if ( is_home() ) {
  278. if ( isset($_GET['cidade_input']) && $_GET['cidade_input'] != '-1' ) {
  279. $cidade_termo = esc_sql($_GET['cidade_input']);
  280. $query->set('cidade', $cidade_termo);
  281. }
  282. if ( isset($_GET['regiao_input']) && $_GET['regiao_input'] != '-1') {
  283. $regiao_termo = esc_sql($_GET['regiao_input']);
  284. $query->set('regiao', $regiao_termo);
  285. }
  286. if ( isset($_GET['tipo_input']) && $_GET['tipo_input'] != '-1') {
  287. $tipo_termo = esc_sql($_GET['tipo_input']);
  288. $query->set('tipo', $tipo_termo);
  289. }
  290. }
  291. //Faça para o restante
  292. }
  293. }
  294. add_filter( 'template_include', 'portfolio_page_template', 99 );
  295. function portfolio_page_template( $template ) {
  296. if ( $_GET['tipo_input'] ) {
  297. $new_template = locate_template( array( 'search.php' ) );
  298. if ( '' != $new_template ) {
  299. return $new_template ;
  300. }
  301. }
  302. return $template;
  303. }
  304. add_filter( 'template_include', 'portfolio_page_template', 99 );
  305. function portfolio_page_template_1( $template ) {
  306. if ( $_GET['cidade_input'] ) {
  307. $new_template = locate_template( array( 'search.php' ) );
  308. if ( '' != $new_template ) {
  309. return $new_template ;
  310. }
  311. }
  312. return $template;
  313. }
  314.  
  315. add_filter( 'template_include', 'portfolio_page_template', 99 );
  316. function portfolio_page_template_2( $template ) {
  317. if ( $_GET['regiao_input'] ) {
  318. $new_template = locate_template( array( 'search.php' ) );
  319. if ( '' != $new_template ) {
  320. return $new_template ;
  321. }
  322. }
  323. return $template;
  324. }
  325. require_once('wp-advanced-search/wpas.php');
  326. add_theme_support( 'post-thumbnails' );
  327.  
  328.  
  329.  
  330. archive-quadras.php
  331. <?php
  332. /*
  333. Template Name: Quadra
  334. */
  335. ?>
  336. <?php get_header(); ?>
  337. <!----AQUI COMEÇA O MEIO 100%---->
  338. <div id="meio">
  339. <div id="meio_conteudo">
  340. <!-------inicio da div conteudo_do_meio------------------->
  341. <div id="conteudo_do_meio_pagina">
  342. <div id="conteudo_pagina_esquerda">
  343. <div id="conteudo_pagina_esquerda_title">
  344. <h1>Quadras</h1>
  345. </div>
  346.  
  347. <div id="conteudo_pagina_esquerda_pagina">
  348. <p>Listamos os locais onde é possível a prática do tênis, seja em quadras públicas, clubes, academias, associações, hotéis, através de aulas, locações, hospedagem, utilizado para lazer e diversão, escolha a região abaixo:<br />
  349. Para cadastrar sua quadra, <a href="<?php echo get_option('home');?>/?page_id=3166" title="Cadastrar Quadras"><strong>clique aqui.</strong></a> Este serviço é gratuito.</p>
  350.  
  351. <!------AQUI COMEÇA O FORMULÁRIO DE BUSCA---------->
  352. <!--<form role="search" method="get" action="<?php echo get_option('/');?>/?page_id=3159" id="searchform" name="f1">--->
  353. <form role="search" method="get" action="<?php echo home_url()?>" id="searchform" name="f1">
  354.  
  355. <div id="busca_quadra">
  356. <div id="buscaconteudo_quadra">
  357. <div id="buscaconteudo_quadra_1" class="select-estiloso">
  358. <select id="cidade_input" name="cidade_input" class="select-estiloso" onchange="myFunction()">
  359. <option value="-1" selected>Região...</option>
  360. <option value="sul-de-minas">Sul de Minas
  361. <option value="sul-fluminense">Sul Fluminense
  362. <option value="vale-do-paraiba">Vale do Paraiba
  363. </select>
  364. </div>
  365. <div id="buscaconteudo_quadra_2" class="select-estiloso">
  366. <select id="bairro_input" name="bairro_input" class="select-estiloso">
  367. <option value="-1" selected>Cidade</option>
  368. </select>
  369. </div>
  370.  
  371. <div id="buscaconteudo_quadra_3" class="select-estiloso">
  372. <select name="tipo_input" class="select-estiloso">
  373. <option selected value="-1">Tipo</option>
  374. <option value="academia">Academia</option>
  375. <option value="associacao">Associação</option>
  376. <option value="clube">Clube</option>
  377. <option value="hotel">Hotel</option>
  378. <option value="publica">Pública</option>
  379. <option value="outros">Outros</option>
  380. </select>
  381. </div>
  382.  
  383. <div id="buscaconteudo_quadra_6">
  384. <input type="submit" class="send" value="Buscar" id="searchsubmit" />
  385. </div>
  386. </div>
  387. </div>
  388. </form>
  389. <!------AQUI TERMINA O FORMULÁRIO DE BUSCA---------->
  390.  
  391. <!------AQUI EXIBE O RESULTADO DA BUSCA------------->
  392. <?php $newsArgs = array( 'post_type' => 'quadra',);
  393. $newsLoop = new WP_Query( $newsArgs );
  394. while ( $newsLoop->have_posts() ) : $newsLoop->the_post();?>
  395.  
  396. <div id="quadras_informacoes">
  397. <h1><a href="<?php the_Permalink()?>" title="<?php the_title();?>"><?php the_title();?></a></h1>
  398. <p><strong>Cidade:</strong>&nbsp; <?php the_field('cidade_da_quadra');?></p>
  399. <p><strong>Endereço:</strong>&nbsp;<?php the_field('endereco_da_quadra');?></p>
  400. </div>
  401. <div id="separador_noticias"></div>
  402.  
  403. <?php endwhile; ?>
  404. <?php wp_reset_postdata(); // reset the query ?>
  405. </div>
  406. <br><br>
  407. <div id="pagenave">
  408. <?php if(function_exists('wp_pagenavi')) {wp_pagenavi();}?>
  409. </div>
  410. </div>
  411.  
  412. <!-----COMEÇA A SIDEBAR---->
  413. <?php get_sidebar(); ?>
  414. <!----TERMINA SIDEBAR------>
  415. </div>
  416. <div id="divclear"></div>
  417. <div id="separador"></div>
  418. <!-------termino da div conteudo_do_meio------------------>
  419. </div>
  420. </div>
  421. <!----AQUI TERMINA O MEIO 100%---->
  422. <?php get_footer(); ?>
  423.  
  424.  
  425.  
  426.  
  427. search.php
  428.  
  429. <?php get_header(); ?>
  430. <!----AQUI COMEÇA O MEIO 100%---->
  431. <div id="meio">
  432. <div id="meio_conteudo">
  433. <!-------inicio da div conteudo_do_meio------------------->
  434. <div id="conteudo_do_meio_pagina">
  435. <div id="conteudo_pagina_esquerda">
  436. <div id="conteudo_pagina_esquerda_title">
  437. <h1>Resultado da busca</h1>
  438. </div>
  439. <?php if (have_posts()): while (have_posts()) : the_post();?>
  440. <div id="conteudo_pagina_esquerda_pagina">
  441. <h5 style="background-image:url(<?=bloginfo('template_url')?>/images/noimagem.png)"><img src="<?php $key="feature";echo get_post_meta($post->ID,$key,true);?>" border="0" width="155px" height="107px"></h5>
  442. <h1><a href="<?php the_Permalink()?>" title="<?php the_title();?>" alt="<?php the_title();?>"><?php the_title();?></a></h1>
  443. <h2><?php the_time('j M Y');?> | <?php if(function_exists('the_views')){the_views();}?> | <?php comments_popup_link('0 comentário','1 comentário','Comentários');?></h2>
  444. <p><a href="<?php the_Permalink()?>" title="<?php the_title();?>" alt="<?php the_title();?>"><?php the_excerpt_rereloaded(12);?></a></p>
  445. </div>
  446. <div id="separador_noticias"></div>
  447. <?php endwhile; else:?>
  448. <?php endif;?>
  449. <br><br>
  450. <div id="pagenave">
  451. <?php if(function_exists('wp_pagenavi')) {wp_pagenavi();}?>
  452. </div>
  453. </div>
  454.  
  455. <!-----COMEÇA A SIDEBAR---->
  456. <?php get_sidebar(); ?>
  457. <!----TERMINA SIDEBAR------>
  458. </div>
  459. <div id="divclear"></div>
  460. <div id="separador"></div>
  461. <!-------termino da div conteudo_do_meio------------------>
  462. </div>
  463. </div>
  464. <!----AQUI TERMINA O MEIO 100%---->
  465. <?php get_footer(); ?>
');