This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Menu Dinâmico | |
add_action( 'init', 'menu_dinamico' ); | |
function menu_dinamico(){ | |
register_nav_menus( | |
array( | |
'top-menu' => __( 'Menu Topo' ), | |
'main-menu' => __( 'Menu Principal' ), | |
'footer-menu' => __( 'Menu Rodapé' ) | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE wp_options | |
SET option_value = REPLACE(option_value, 'http://localhost/site', 'http://www.site.com.br') | |
WHERE option_name = 'home' | |
OR option_name = 'siteurl'; | |
UPDATE wp_posts | |
SET guid = REPLACE (guid, 'http://localhost/site', 'http://www.site.com.br'); | |
UPDATE wp_posts | |
SET post_content = REPLACE (post_content, 'http://localhost/site', 'http://www.site.com.br'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('wp_title', 'my_wp_title', 10, 2); | |
function my_wp_title($title, $sep){ | |
global $paged, $page; | |
if (is_feed()) { | |
return $title; | |
} | |
// Add o nome do site. | |
$title .= get_bloginfo('name'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu { | |
function start_lvl( &$output, $depth ) { | |
//In a child UL, add the 'dropdown-menu' class | |
$indent = str_repeat( "\t", $depth ); | |
$output .= "\n$indent<ul class=\"dropdown-menu\">\n"; | |
} | |
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { | |
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function page_navi($pages = '', $range = 2){ | |
$showitems = ($range * 2)+1; | |
global $paged; | |
if(empty($paged)) $paged = 1; | |
if($pages == ''){ | |
global $wp_query, $wpdb; | |
$pages = $wp_query->max_num_pages; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'right_now_content_table_end' , 'my_right_now_content_table_end' ); | |
function my_right_now_content_table_end() { | |
$args = array( | |
'public' => true , | |
'_builtin' => false | |
); | |
$output = 'object'; | |
$operator = 'and'; | |
$post_types = get_post_types( $args , $output , $operator ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class My_Recent_Posts_Widget extends WP_Widget_Recent_Posts { | |
function widget($args, $instance) { | |
extract( $args ); | |
$title = apply_filters('widget_title', empty($instance['title']) ? __('Tópicos recentes') : $instance['title'], $instance, $this->id_base); | |
if( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) ) | |
$number = 5; | |
$r = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) ) ); | |
if( $r->have_posts() ) : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Pega todas as categorias do post | |
$cats = get_the_category($post->ID); | |
//Verifica a primeira categoria retornada e pega seu parentesco. | |
//Se um post tem múltiplas categorias que levam a parentescos separados, retornará o primeiro parentesco pertencente à primeira categoria retornada. | |
$parent = get_category($cats[0]->category_parent); | |
//Se obtiver uma mesnagem de erro, significa que já estamos na categoria-pai. | |
if (is_wp_error($parent)){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git remote add upstream <url-do-repositorio-original> | |
git fetch upstream | |
git checkout master | |
git reset --hard upstream/master | |
git push origin master --force |
OlderNewer