Advertisement
Guest User

functions.php

a guest
Apr 13th, 2015
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.99 KB | None | 0 0
  1. <?php
  2. /**
  3. * New Web FUNCTIONS FILE
  4. *
  5. *@subpackage mydomainofficial
  6. *
  7. */
  8.  
  9. // This is the secret key for API authentication. You configured it in the settings menu of the license manager plugin..
  10. define('tema_sintaxedomain', '55265dd116c3c9.94260852'); //Rename this constant name so it is specific to your plugin or theme.
  11.  
  12. // This is the URL where API query request will be sent to. This should be the URL of the site where you have installed the main license manager plugin. Get this value from the integration help page.
  13. define('sintaxedomain_licenca_servidor_url', 'http://www.mydomainofficial.com.br'); //Rename this constant name so it is specific to your plugin or theme.
  14.  
  15.  
  16. // This is a value that will be recorded in the license manager data so you can identify licenses for this item/product
  17. define('sintaxedomain_item_referencia', 'Tema New Web');//Rename this constant name so it is specific to your plugin or theme.
  18.  
  19. add_action('admin_menu', 'slm_sample_license_menu');
  20.  
  21. function slm_sample_license_menu() {
  22. add_options_page('Menu de Ativação de Licença', 'Licença New Web', 'manage_options', __FILE__, 'sample_license_management_page');
  23. }
  24.  
  25. function sample_license_management_page() {
  26. echo '<div class="wrap">';
  27. echo '<h2>Gerenciar sua licença</h2>';
  28.  
  29. /*** License activate button was clicked ***/
  30. if (isset($_REQUEST['activate_license'])) {
  31. $license_key = $_REQUEST['sample_license_key'];
  32.  
  33. // API query parameters
  34. $api_params = array(
  35. 'slm_action' => 'slm_activate',
  36. 'secret_key' => tema_sintaxedomain,
  37. 'license_key' => $license_key,
  38. 'registered_domain' => $_SERVER['SERVER_NAME'],
  39. 'item_reference' => urlencode(sintaxedomain_item_referencia),
  40. );
  41.  
  42. // Send query to the license manager server
  43. $response = wp_remote_get(add_query_arg($api_params, sintaxedomain_licenca_servidor_url), array('timeout' => 20, 'sslverify' => false));
  44.  
  45. // Check for error in the response
  46. if (is_wp_error($response)){
  47. echo "Erro inesperado! A consulta retornou com um erro.";
  48. }
  49.  
  50. //var_dump($response);//uncomment it if you want to look at the full response
  51.  
  52. // License data.
  53. $license_data = json_decode(wp_remote_retrieve_body($response));
  54.  
  55. // TODO - Do something with it.
  56. //var_dump($license_data);//uncomment it to look at the data
  57.  
  58. if($license_data->result == 'success'){//Success was returned for the license activation
  59.  
  60. //Uncomment the followng line to see the message that returned from the license server
  61. echo '<br /><strong>Situação da chave</strong>: '.$license_data->message;
  62.  
  63. //Save the license key in the options table
  64. update_option('sample_license_key', $license_key);
  65. }
  66. else{
  67. //Show error to the user. Probably entered incorrect license key.
  68.  
  69. //Uncomment the followng line to see the message that returned from the license server
  70. echo '<br /><strong>Situação da chave</strong>: '.$license_data->message;
  71. }
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85. // mydomainofficial Width Based on Size
  86. if ( ! isset( $content_width ) )
  87. $content_width = 780; // pixels
  88.  
  89. /*** mydomainofficial Included Files ***/
  90.  
  91. // mydomainofficial Bootstrap Nav Walker
  92.  
  93. require_once('inc/bootstrap_navwalker.php');
  94. require_once('framework/functions.php');
  95. // mydomainofficial template-tags.php
  96. require_once('inc/template-tags.php');
  97.  
  98. // mydomainofficial Custom Header
  99.  
  100. // mydomainofficial Custom Background
  101. $avon_bg = array(
  102. 'default-image' => get_template_directory_uri() . '',
  103. );
  104. add_theme_support( 'custom-background', $avon_bg );
  105.  
  106. // mydomainofficial RSS feed links
  107. add_theme_support( 'automatic-feed-links' );
  108.  
  109. // mydomainofficial Theme Title
  110. add_filter( 'wp_title', 'filter_wp_title' );
  111. function filter_wp_title( $title ) {
  112. global $page, $paged;
  113. if ( is_feed() )
  114. return $title;
  115. $site_description = get_bloginfo( 'description' );
  116. $filtered_title = $title . get_bloginfo( 'name' );
  117. $filtered_title .= ( ! empty( $site_description ) && ( is_home() || is_front_page() ) ) ? ' | ' . $site_description: '';
  118. $filtered_title .= ( 2 <= $paged || 2 <= $page ) ? ' | ' . sprintf( __( 'Página %s', 'mydomainofficial' ), max( $paged, $page ) ) : '';
  119. return $filtered_title;
  120. }
  121. // mydomainofficial Post Thumbnails
  122. add_theme_support('post-thumbnails');
  123. add_image_size ( 'slide-image', 850, 380, true );
  124. add_image_size ( 'slide-image-reduzida', 850, 280, true );
  125. add_image_size ( 'home-thumb-gera', 265, 240, true );
  126. add_image_size ( 'home-thumb-referencia', 198, 253, true );
  127. add_image_size ( 'home-blog-thumb', 150, 150, true );
  128. // mydomainofficial Post relacionados
  129. set_post_thumbnail_size( 196, 110, true );
  130. // mydomainofficial Post Formats
  131. add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status', 'gallery', 'video', 'audio', 'chat' ) );
  132. // mydomainofficial Registering Menu
  133. register_nav_menu( 'primary', __( 'Menu Principal', 'mydomainofficial' ) );
  134. // mydomainofficial Scipts and Style Files
  135. function mydomainofficial_scripts_styles() {
  136. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
  137. wp_enqueue_script( 'comment-reply' );
  138. // mydomainofficial Main Js File
  139. wp_enqueue_script( 'jquery' );
  140. wp_enqueue_script( '', get_template_directory_uri() . '/js/bootstrap.js', array(), '3.0', true );
  141. // mydomainofficial Main Bootstrap Css File
  142. wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.0', false );
  143. wp_enqueue_style( 'iconfont', get_template_directory_uri() . '/css/font-awesome.css', array());
  144. // mydomainofficial Theme Main Stylesheet
  145. wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() );
  146. }
  147. add_action( 'wp_enqueue_scripts', 'mydomainofficial_scripts_styles' );
  148.  
  149. //data em quantidade de dias
  150. function time_ago() {
  151. echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' atrás';
  152. }
  153.  
  154. // mydomainofficial Comentários/Pingbacks
  155. if ( ! function_exists( 'mydomainofficial_comment' ) ) :
  156. function mydomainofficial_comment( $comment, $args, $depth ) {
  157. $GLOBALS['comment'] = $comment;
  158. if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>
  159. <li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
  160. <div class="comment-body">
  161. <?php _e( 'Pingback:', 'mydomainofficial' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Editar', 'mydomainofficial' ), '<span class="edit-link">', '</span>' ); ?>
  162. </div>
  163. <?php else : ?>
  164. <li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
  165. <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
  166. <footer class="comment-meta">
  167. <div class="comment-author vcard">
  168. <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
  169. <?php printf( __( '%s <span class="says"> a </span>', 'mydomainofficial' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
  170. <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
  171. <time datetime="<?php comment_time( 'U' ); ?>">
  172. <?php echo time_ago(); ?>
  173. </time>
  174. </a>
  175. </div><!-- .comment-author -->
  176. <div class="comment-metadata">
  177.  
  178. <?php edit_comment_link( __( 'Editar', 'mydomainofficial' ), '<span class="edit-link">', '</span>' ); ?>
  179. </div><!-- .comment-metadata -->
  180. <?php if ( '0' == $comment->comment_approved ) : ?>
  181. <p class="comment-awaiting-moderation"><?php _e( 'Seu comentário está aguardando moderação.', 'mydomainofficial' ); ?></p>
  182. <?php endif; ?>
  183. </footer><!-- .comment-meta -->
  184. <div class="comment-content">
  185. <?php comment_text(); ?>
  186. </div><!-- .comment-content -->
  187. <?php
  188. comment_reply_link( array_merge( $args, array(
  189. 'add_below' => 'div-comment',
  190. 'depth' => $depth,
  191. 'max_depth' => $args['max_depth'],
  192. 'before' => '<div class="reply">',
  193. 'after' => '</div>',
  194. ) ) );
  195. ?>
  196. </article><!-- .comment-body -->
  197. <?php
  198. endif;
  199. }
  200. endif; // ends check for mydomainofficial_comment()
  201. if ( ! function_exists( 'mydomainofficial_comment_reply_link' ) ):
  202. // Style comment reply links as buttons
  203. function mydomainofficial_comment_reply_link( $link ) {
  204. return str_replace( 'comment-reply-link', 'btn btn-default btn-xs', $link );
  205. }
  206. add_filter( 'comment_reply_link', 'mydomainofficial_comment_reply_link' );
  207. endif;
  208. // mydomainofficial Pagination
  209. function mydomainofficial_pagination_nav($pages = '', $range = 2)
  210. {
  211. $showitems = ($range * 2)+1;
  212. global $paged;
  213. if(empty($paged)) $paged = 1;
  214. if($pages == '')
  215. {
  216. global $wp_query;
  217. $pages = $wp_query->max_num_pages;
  218. if(!$pages)
  219. {
  220. $pages = 1;
  221. }
  222. }
  223. if(1 != $pages) {
  224. echo "<div class='pagination-wrap'><ul class='pagination'>";
  225. if($paged > 2 && $paged > $range+1 && $showitems < $pages)
  226. echo "<li><a href='".get_pagenum_link(1)."'>&laquo;</a></li>";
  227. if($paged > 1 && $showitems < $pages)
  228. echo "<li><a href='".get_pagenum_link($paged - 1)."'>&lsaquo;</a></li>";
  229. for ($i=1; $i <= $pages; $i++) {
  230. if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
  231. {
  232. echo ($paged == $i)? "<li class='active'><span class='current'>".$i."</span></li>":"<li><a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a></li>";
  233. }
  234. }
  235. if ($paged < $pages && $showitems < $pages)
  236. echo "<li><a href='".get_pagenum_link($paged + 1)."'>&rsaquo;</a></li>";
  237. if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages)
  238. echo "<li><a href='".get_pagenum_link($pages)."'>&raquo;</a></li>";
  239. echo "</ul></div>";
  240. }
  241. }
  242. // mydomainofficial Sidebar
  243. if ( ! function_exists( 'sidebar_widgets' ) ) :
  244. function sidebar_widgets() {
  245. register_sidebar( array(
  246. 'id' => 'sidebar_principal',
  247. 'name' => __( 'Sidebar Principal', 'mydomainofficial' ),
  248. 'description' => __( 'Esta barra lateral está localizado no lado direito ou esquerdo de cada página.', 'mydomainofficial' ),
  249. 'before_widget' => '<aside class="well widget %2$s" id="%1$s">',
  250. 'after_widget' => '</aside>',
  251. 'before_title' => '<h3 class="widget-title">',
  252. 'after_title' => '</h3>',
  253. ) );
  254.  
  255. }
  256. add_action( 'widgets_init', 'sidebar_widgets' );
  257. endif;
  258.  
  259. // mydomainofficial WP Link Pages
  260. $mydomainofficial_wp_link_pages = array(
  261. 'before' => '<p>' . __( 'Páginas:', 'mydomainofficial' ),
  262. 'after' => '</p>',
  263. 'link_before' => '',
  264. 'link_after' => '',
  265. 'next_or_number' => 'number',
  266. 'separator' => ' ',
  267. 'nextpagelink' => __( 'Próxima página', 'mydomainofficial' ),
  268. 'previouspagelink' => __( 'Página anterior', 'mydomainofficial' ),
  269. 'pagelink' => '%',
  270. 'echo' => 1
  271. );
  272.  
  273. //* Adiciona informações do tema no box do painel do WordPress
  274. function wgr_add_dashboard_widgets() {
  275. wp_add_dashboard_widget('wp_dashboard_widget', 'Detalhes do Tema', 'wgr_theme_info');
  276. }
  277. add_action('wp_dashboard_setup', 'wgr_add_dashboard_widgets' );
  278.  
  279. function wgr_theme_info() {
  280. echo "<ul>
  281. <li><strong>Desenvolvido por:</strong> New Web</li>
  282. <li><strong>Website:</strong> <a href='http://www.mydomainofficial.com.br'>www.mydomainofficial.com.br</a></li>
  283. <li><strong>Contato:</strong> <a href='mailto:sintaxedomain@gmail.com'>sintaxedomain@gmail.com</a></li>
  284. </ul>";
  285. };
  286.  
  287. /*-----------------------------------------------------------------------------*
  288. Customizar painel do Admin
  289. *-----------------------------------------------------------------------------*/
  290.  
  291. // customizando texto footer do admin
  292. function custom_admin_footer() {
  293. echo ' Personalizado por <a href="http://www.sintaxedomain.com.br" title="Tema New Web" target="_self">New Web </a>';
  294. }
  295. add_filter('admin_footer_text', 'custom_admin_footer');
  296.  
  297. //remover barra Admin do front end
  298. function my_function_admin_bar(){
  299. return false;
  300. }
  301. add_filter( "show_admin_bar" , "my_function_admin_bar");
  302.  
  303. //Remove Opção de tela
  304. function mydomainofficial_remove_screen_options(){
  305. return false;
  306. }
  307. add_filter('screen_options_show_screen', 'mydomainofficial_remove_screen_options');
  308.  
  309. //Mudar Titulo hover
  310. add_filter('login_headertitle', 'mydomainofficial_custom_wp_login_title');
  311. function mydomainofficial_custom_wp_login_title() {
  312. return get_option('blogname');
  313. }
  314.  
  315. //Link logo Login
  316. add_filter('login_headerurl', 'mydomainofficial_custom_wp_login_url');
  317. function mydomainofficial_custom_wp_login_url() {
  318. return home_url();
  319. }
  320. //altearando cor barra admin
  321. function mydomainofficial_custom_colors() {
  322. echo '<style type="text/css">#wpadminbar {background:#2C3E50}</style>';
  323. }
  324. add_action('admin_head', 'mydomainofficial_custom_colors');
  325.  
  326. //Cores do Status dos posts
  327. add_action('admin_footer','mydomainofficial_posts_status_color');
  328. function mydomainofficial_posts_status_color(){
  329. ?>
  330. <style>
  331. .status-draft{background: #FCE3F2 !important;}
  332. .status-pending{background: #87C5D6 !important;}
  333. .status-publish{/* Nenhum background. Manter as cores alternadas */}
  334. .status-future{background: #C6EBF5 !important;}
  335. .status-private{background:#F2D46F;}
  336. </style>
  337. <?php
  338. }
  339.  
  340. //alterando fundo admin
  341. add_action( 'login_head', 'mydomainofficial_custom_login' );
  342. function mydomainofficial_custom_login() {
  343. echo '<link media="all" type="text/css" href="'.get_template_directory_uri().'/framework/admin/login-style.css" rel="stylesheet">';
  344. }
  345.  
  346.  
  347. //Esconder opção de Cores do painel
  348. function admin_color_scheme() {
  349. global $_wp_admin_css_colors;
  350. $_wp_admin_css_colors = 0;
  351. }
  352. add_action('admin_head', 'admin_color_scheme');
  353.  
  354. /**
  355. * Array de definições de configuração. Alterar cada linha, conforme necessário.
  356. * Se você quiser as cordas padrão para estar disponível sob seu próprio domínio do tema,
  357. * Deixar as cordas descomentada.
  358. * Algumas das cordas são adicionados em um sprintf, por isso ver os comentários no
  359. * Final de cada linha para o que cada argumento será.
  360. */
  361. $config = array(
  362. 'domain' => 'mydomainofficial', // Text domain - likely want to be the same as your theme.
  363. 'default_path' => '', // Default absolute path to pre-packaged plugins
  364. 'parent_menu_slug' => 'themes.php', // Default parent menu slug
  365. 'parent_url_slug' => 'themes.php', // Default parent URL slug
  366. 'menu' => 'install-required-plugins', // Menu slug
  367. 'has_notices' => true, // Show admin notices or not
  368. 'is_automatic' => true, // Automatically activate plugins after installation or not
  369. 'message' => '', // Message to output right before the plugins table
  370. 'strings' => array(
  371. 'page_title' => __( 'Instalação Obrigatório de Plugins', '' ),
  372. 'menu_title' => __( 'Instalação de Plugins', 'mydomainofficial' ),
  373. 'installing' => __( 'Instalando o Plugin: %s', 'mydomainofficial' ), // %1$s = plugin name
  374. 'oops' => __( 'Algo deu errado com o plugin API.', 'mydomainofficial' ),
  375. 'notice_can_install_required' => _n_noop( 'Este tema requer o seguinte plug-in: %1$s.', 'Este tema exige os seguintes plugins: %1$s.' ), // %1$s = plugin name(s)
  376. 'notice_can_install_recommended' => _n_noop( 'Este tema recomenda o seguinte plug-in: %1$s.', 'Este tema recomenda os seguintes plugins: %1$s.' ), // %1$s = plugin name(s)
  377. 'notice_cannot_install' => _n_noop( 'Desculpe, mas você não tem as permissões corretas para instalar o plugin %s. Contatar o administrador do site para obter ajuda sobre como tirar o plugin instalado. ',' Desculpe, mas você não tem as permissões corretas para instalar plugins %s. Contactar o administrador do site para obter ajuda em obter os plugins instalados.' ), // %1$s = plugin name(s)
  378. 'notice_can_activate_required' => _n_noop( 'O seguinte plugin necessário está atualmente inativo: %1$s.', 'Os seguintes plugins necessários estão inativo no momento: %1$s.' ), // %1$s = plugin name(s)
  379. 'notice_can_activate_recommended' => _n_noop( 'O seguinte plug-in recomendado esta inativo no momento: %1$s.', 'Os seguintes plugins recomendados estão inativo no momento: %1$s.' ), // %1$s = plugin name(s)
  380. 'notice_cannot_activate' => _n_noop( 'Desculpe, mas você não tem as permissões corretas para ativar o plugin %s. Contactar o administrador do site para obter ajuda em obter o plugin ativado. ',' Desculpe, mas você não tem as permissões corretas para ativar plugins %s. Contactar o administrador do site para obter ajuda em obter os plugins ativados.' ), // %1$s = plugin name(s)
  381. 'notice_ask_to_update' => _n_noop( 'O seguinte plugin precisa ser atualizado para a versão mais recente para garantir o máximo de compatibilidade com este tema: %1$s.', 'Os seguintes plugins precisam ser atualizados para a sua versão mais recente para garantir a máxima compatibilidade com este tema: %1$s.' ), // %1$s = plugin name(s)
  382. 'notice_cannot_update' => _n_noop( 'Desculpe, mas você não tem as permissões corretas para atualizar o plug-in %s. Contactar o administrador do site para obter ajuda em obter o plugin atualizado. ',' Desculpe, mas você não tem as permissões corretas para atualizar plugins %s. Contactar o administrador do site para obter ajuda em obter os plugins atualizados.' ), // %1$s = plugin name(s)
  383. 'install_link' => _n_noop( 'Comece a instalação de plug-in', 'Comece a instalação dos plugins' ),
  384. 'activate_link' => _n_noop( 'Ative o plugin instalado', 'Ative os plugins instalados' ),
  385. 'return' => __( 'Retornar para instalação de Plugins Obrigatório', 'mydomainofficial' ),
  386. 'plugin_activated' => __( 'Plugin ativado com sucesso.', 'mydomainofficial' ),
  387. 'complete' => __( 'Todos os plugins instalado e ativado com sucesso. %s', 'mydomainofficial' ), // %1$s = dashboard link
  388. 'nag_type' => 'updated' // Determines admin notice type - can only be 'updated' or 'error'
  389. )
  390. );
  391.  
  392. wpgr( $plugins, $config );
  393.  
  394. }
  395.  
  396. function new_excerpt_more( $more ) {
  397. return ' ... <a class="leia-mais" href="'. get_permalink( get_the_ID() ) . '">'. get_theme_option('txtartigosleiamais') .'</a>';
  398. }
  399. add_filter( 'excerpt_more', 'new_excerpt_more' );
  400.  
  401. function custom_excerpt_length( $length ) {
  402. return ''. get_theme_option('qtdcaracterleiamais') .'';
  403. }
  404. add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
  405.  
  406.  
  407. /*-----------------------------------------------------------------------------*
  408. Botões das Redes Sociais
  409. *-----------------------------------------------------------------------------*/
  410.  
  411. add_action( 'wp_footer', 'include_social_js' );
  412. function include_social_js() {
  413.  
  414. $lang = get_bloginfo('language');
  415. $lang_g = strtolower(substr($lang, 0, 2));
  416. $lang_fb = str_replace('-', '_', $lang);
  417. ?>
  418.  
  419. <!-- Social -->
  420. <script type="text/javascript">
  421. //<![CDATA[
  422. // google plus
  423. window.___gcfg = {lang: '<?php echo $lang_g; ?>'};
  424. (function() {
  425. var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
  426. po.src = 'https://apis.google.com/js/plusone.js';
  427. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
  428. })();
  429.  
  430. // facebook
  431. document.write('<div id="fb-root"></div>');
  432. (function(d, s, id) {
  433. var js, fjs = d.getElementsByTagName(s)[0];
  434. if (d.getElementById(id)) return;
  435. js = d.createElement(s); js.id = id;
  436. js.src = "//connect.facebook.net/<?php echo $lang_fb; ?>/all.js#xfbml=1";
  437. fjs.parentNode.insertBefore(js, fjs);
  438. }(document, 'script', 'facebook-jssdk'));
  439.  
  440. // twitter
  441. !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
  442. // ]]>
  443. </script>
  444. <!-- /Social -->
  445.  
  446. <?php
  447. }
  448. function social_buttons_code(){
  449.  
  450. global $post;
  451. $permalink = get_permalink($post->ID);
  452. $title = get_the_title($post->ID);
  453.  
  454. $buttonsCode = array();
  455.  
  456. //facebook
  457. $buttonsCode[] = '<div class="social social-button-fblike"><!-- Facebook like--><div id="fb-root"></div><div class="fb-like" data-href="'.$permalink.'" data-send="false" data-layout="button_count" data-width="100" data-height="20" data-show-faces="false"></div></div>'; //data-send="true" se quiser combinar like button com send button
  458.  
  459. //Twitter
  460. $buttonsCode[] = '<div class="social social-buttom-twitter"><!-- Twitter--><div id="twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-text="'.$title.'" data-url="'.$permalink.'" rel="nofollow"></a></div></div>';
  461.  
  462. //G+
  463. $buttonsCode[] = '<div class="social social-button-googleplus"><!-- Google Plus One--><div class="g-plusone" data-size="medium" data-href="'.$permalink.'"></div></div>';
  464.  
  465. $social_buttonscode = '<div id="social-buttons-wrapper" class="clearfix">'."\n";
  466. $social_buttonscode .= implode("\n", $buttonsCode) . "\n";
  467. $social_buttonscode .= '</div>'."\n";
  468.  
  469. return $social_buttonscode;
  470.  
  471. }
  472. add_filter( 'the_content', 'insert_social_buttons' );
  473.  
  474. //Se quiser que os botões apareçam também nos resumos, descomente a linha abaixo....
  475. //add_filter( 'the_excerpt', 'insert_social_buttons' );
  476.  
  477. function insert_social_buttons($content){
  478. if( !is_page() || !is_search() ){
  479.  
  480. //incluo os botões antes do conteúdo... Se quiser que apareça depois do conteúdo, basta colocar a linha $social_content = social_ ... depois da variável $content = $social_...
  481. $social_content = social_buttons_code();
  482. $content = $social_content . $content;
  483. }
  484.  
  485. return $content;
  486.  
  487. }
  488.  
  489. /*-----------------------------------------------------------------------------*
  490. Novos campos de contato
  491. *-----------------------------------------------------------------------------*/
  492.  
  493. if ( ! function_exists('mydomainofficial_new_contact_fields') ) {
  494.  
  495. function mydomainofficial_new_contact_fields( $contact_fields ) {
  496. // Twitter
  497. $contact_fields['twitter'] = 'Twitter URL - Usar: http://';
  498.  
  499. // Facebbok
  500. $contact_fields['facebook'] = 'Facebook - Usar: URL http://';
  501.  
  502. // Google+
  503. $contact_fields['googleplus'] = 'Google+ - Usar: URL http://';
  504.  
  505. return $contact_fields;
  506. } // neweb_new_contact_fields
  507.  
  508. add_filter('user_contactmethods', 'mydomainofficial_new_contact_fields', 10, 1);
  509.  
  510. } // function_existsaa
  511.  
  512. /*-----------------------------------------------------------------------------*
  513. author no single
  514. *-----------------------------------------------------------------------------*/
  515.  
  516. if ( ! function_exists('mydomainofficial_author_area') ) {
  517.  
  518. function mydomainofficial_author_area() {
  519.  
  520. // Apenas apresentaremos a área do autor nos posts na íntegra
  521. if ( is_single() ):
  522. $author_id = get_the_author_meta( 'ID' );
  523. ?>
  524.  
  525. <!-- Área do autor -->
  526. <div class="tp-author-area clearfix">
  527.  
  528. <!-- Conteúdo interno da área do autor -->
  529. <div class="tp-inner-author-area">
  530.  
  531. <!-- Gravatar -->
  532. <div class="tp-author-gravatar">
  533.  
  534. <?php if(get_theme_option('avatar-upload')) {?>
  535. <a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src ="<?php echo esc_url(get_theme_option('avatar-upload')); ?>" /></a>
  536. <?php } else { ?>
  537.  
  538. <a class="tp-author-link" href="<?php echo esc_url( get_author_posts_url( $author_id ) ); ?>">
  539. <?php echo get_avatar( get_the_author_meta( 'user_email' ), 150 ); ?>
  540. </a>
  541.  
  542. <?php } ?>
  543.  
  544. </div> <!-- tp-author-gravatar -->
  545.  
  546.  
  547. <!-- Nome e link do autor -->
  548. <h3 class="tp-about-autor-heading">
  549. <span class="byline"><span class="glyphicon glyphicon-user"></span> <span class="author vcard">
  550. <a href="<?php echo get_author_posts_url( $author_id );?>">
  551. <?php echo get_the_author(); ?>
  552. </a>
  553. </span></span>
  554. </h3>
  555.  
  556. <!-- Descrição do autor -->
  557. <div class="tp-author-info">
  558.  
  559. <?php the_author_meta( 'description' ); ?>
  560.  
  561. </div> <!-- tp-author-info -->
  562.  
  563. <!-- Links sociais -->
  564.  
  565. <p class="tp-social-links clearfix">
  566.  
  567. <?php if ( get_the_author_meta( 'facebook', $author_id ) ): ?>
  568.  
  569. <a class="tp-author-social-link-f" href="<?php
  570. echo get_the_author_meta( 'facebook', $author_id );
  571. ?>" target="_blank"><i class="fa fa-facebook"></i></a> <i class="fa fa-circle"></i>
  572.  
  573. <?php endif;?>
  574.  
  575. <?php if ( get_the_author_meta( 'googleplus', $author_id ) ): ?>
  576. <a class="tp-author-social-link-g" href="<?php
  577. echo get_the_author_meta( 'googleplus', $author_id );
  578. ?>?rel=author" rel="author" target="_blank"><i class="fa fa-google-plus"></i> </a> <i class="fa fa-circle"></i>
  579. <?php endif;?>
  580.  
  581. <?php if ( get_the_author_meta( 'twitter', $author_id ) ): ?>
  582. <a class="tp-author-social-link-t" href="<?php
  583. echo get_the_author_meta( 'twitter', $author_id );
  584. ?>" target="_blank"><i class="fa fa-twitter"></i></a>
  585. <?php endif;?>
  586.  
  587. </p>
  588. </div> <!-- tp-inner-author-area -->
  589. </div> <!-- tp-author-area -->
  590.  
  591. <?php endif; // is_single() ?>
  592. <?php
  593. } // mydomainofficial_author_area
  594.  
  595. } // function_exists
  596.  
  597.  
  598. /*-----------------------------------------------------------------------------*
  599. author in sidebar
  600. *-----------------------------------------------------------------------------*/
  601.  
  602. if ( ! function_exists('mydomainofficial_author_area_sidebar') ) {
  603.  
  604. function mydomainofficial_author_area_sidebar() {
  605.  
  606. // Apenas apresentaremos a área do autor na sidebar.
  607.  
  608. $author_id = get_the_author_meta( 'ID' );
  609. ?>
  610.  
  611. <!-- Área do autor -->
  612. <div class="tp-author-area clearfix" style="text-align:center">
  613.  
  614. <!-- Conteúdo interno da área do autor -->
  615. <div class="tp-inner-author-area">
  616.  
  617. <!-- Gravatar -->
  618. <div class="tp-author-gravatar-sidebar">
  619.  
  620. <?php if(get_theme_option('avatar-upload')) {?>
  621.  
  622. <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
  623.  
  624. <img src ="<?php echo esc_url(get_theme_option('avatar-upload')); ?>" />
  625.  
  626. </a>
  627.  
  628. <?php } else { ?>
  629.  
  630. <a class="tp-author-link" href="<?php echo esc_url( get_author_posts_url( $author_id ) ); ?>">
  631. <?php echo get_avatar( get_the_author_meta( 'user_email' ), 150 ); ?>
  632.  
  633. </a>
  634.  
  635. <?php } ?>
  636.  
  637. </div> <!-- tp-author-gravatar -->
  638.  
  639. <div class="clearfix"></div>
  640.  
  641. <!-- Nome e link do autor -->
  642. <h3 class="tp-about-autor-heading-sidebar">
  643. <span style="font-weight:bold"> <span class="author vcard">
  644. <a href="<?php echo get_author_posts_url( $author_id );?>">
  645. <?php echo get_the_author(); ?>
  646. </a>
  647. </span></span>
  648. </h3>
  649.  
  650. <!-- Descrição do autor -->
  651. <div class="tp-author-info">
  652.  
  653. <?php the_author_meta( 'description' ); ?>
  654.  
  655. </div> <!-- tp-author-info -->
  656.  
  657. <!-- Links sociais -->
  658.  
  659. <p class="tp-social-links clearfix">
  660.  
  661. <?php if ( get_the_author_meta( 'facebook', $author_id ) ): ?>
  662.  
  663. <a class="tp-author-social-link-f" href="<?php
  664. echo get_the_author_meta( 'facebook', $author_id );
  665. ?>" target="_blank"><i class="fa fa-facebook"></i></a> <i class="fa fa-circle"></i>
  666.  
  667. <?php endif;?>
  668.  
  669. <?php if ( get_the_author_meta( 'googleplus', $author_id ) ): ?>
  670. <a class="tp-author-social-link-g" href="<?php
  671. echo get_the_author_meta( 'googleplus', $author_id );
  672. ?>?rel=author" rel="author" target="_blank"><i class="fa fa-google-plus"></i> </a> <i class="fa fa-circle"></i>
  673. <?php endif;?>
  674.  
  675. <?php if ( get_the_author_meta( 'twitter', $author_id ) ): ?>
  676. <a class="tp-author-social-link-t" href="<?php
  677. echo get_the_author_meta( 'twitter', $author_id );
  678. ?>" target="_blank"><i class="fa fa-twitter"></i></a>
  679. <?php endif;?>
  680.  
  681. </p>
  682. </div> <!-- tp-inner-author-area -->
  683. </div> <!-- tp-author-area -->
  684.  
  685. <?php
  686. } // mydomainofficial_author_area
  687.  
  688. } // function_exists
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700. } /*** End of sample license deactivation ***/
  701.  
  702. ?>
  703. <p>Please enter the license key for this product to activate it. You were given a license key when you purchased this item.</p>
  704. <form action="" method="post">
  705. <table class="form-table">
  706. <tr>
  707. <th style="width:100px;"><label for="sample_license_key">Chave da licença</label></th>
  708. <td ><input class="regular-text" type="text" id="sample_license_key" name="sample_license_key" value="<?php echo get_option('sample_license_key'); ?>" ></td>
  709. </tr>
  710. </table>
  711. <p class="submit">
  712. <input type="submit" name="activate_license" value="Ativar" class="button-primary" />
  713. <input type="submit" name="deactivate_license" value="Desativar" class="button" />
  714. </p>
  715. </form>
  716. <?php
  717.  
  718. echo '</div>';
  719. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement