Skip to content

Instantly share code, notes, and snippets.

View celsofabri's full-sized avatar
👾
The truth is dubious

Celso Fabri Junior celsofabri

👾
The truth is dubious
View GitHub Profile
@celsofabri
celsofabri / find-replace-sql-wp.sql
Created November 20, 2014 21:06
SQL Query para fazer um simples localizar e substituir / SQL Query to do a simple find and replace
UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_links SET link_url = replace(link_url, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_links SET link_image = replace(link_image, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_usermeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');
/*UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl' OR option_name = 'widget_text' OR option_name = 'dashboard_widget_options';*/
UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com');
@celsofabri
celsofabri / gallery-wordpress.css
Created October 24, 2014 19:59
Galeria WordPress
@celsofabri
celsofabri / limit-sticky-posts.php
Last active August 29, 2015 14:07 — forked from fernandofuly/limit-sticky-posts.php
Limit Number of Sticky Posts to Show / Limitando Número de Posts Fixos Exibidos
<?php
$sticky = get_option( 'sticky_posts' );
/* Sort the newest one at the top */
rsort( $sticky );
/* Get the 2 newest stickies (change 2 for a different number) */
$sticky = array_slice( $sticky, 0, 2 );
/* Query Post */
@celsofabri
celsofabri / loop-for-taxonomy.php
Last active July 30, 2020 00:27
Looping for Taxonomy / Looping para taxonomia
<?php
$taxonomy = 'rota_categoria'; //Choose the taxonomy
$terms = get_terms( $taxonomy ); //Get all the terms
$queried_object = get_queried_object();
$term_slug = $queried_object->slug;
$term_id = $queried_object->term_id;
$term_tax = $queried_object->term_taxonomy_id;
@celsofabri
celsofabri / identify-browser-and-os.php
Last active August 31, 2015 20:56
Identify browser and os / Identifica navegador e sistema operacional
<?php
function mv_browser_body_class($classes) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
if($is_lynx) $classes[] = 'lynx';
elseif($is_gecko) $classes[] = 'gecko';
elseif($is_opera) $classes[] = 'opera';
elseif($is_NS4) $classes[] = 'ns4';
elseif($is_safari) $classes[] = 'safari';
elseif($is_chrome) $classes[] = 'chrome';
@celsofabri
celsofabri / exclude-pages-search.php
Last active August 29, 2015 14:06
Exclude "pages" in Search of Wordpress / Excluindo "pages" da busca do WordPress
<?php
function SearchFilter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','SearchFilter');