View remove_css.php
<?php
function remove_jetpack_styles(){
wp_deregister_style('AtD_style'); // After the Deadline
wp_deregister_style('jetpack-carousel'); // Carousel
wp_deregister_style('grunion.css'); // Grunion contact form
wp_deregister_style('the-neverending-homepage'); // Infinite Scroll
wp_deregister_style('infinity-twentyten'); // Infinite Scroll - Twentyten Theme
wp_deregister_style('infinity-twentyeleven'); // Infinite Scroll - Twentyeleven Theme
wp_deregister_style('infinity-twentytwelve'); // Infinite Scroll - Twentytwelve Theme
wp_deregister_style('noticons'); // Notes
View test_if_meta.php
<?php
function test_if_meta($arr, $key, $before = '', $after = '') {
if ($text = $arr[$key][0])
return $before . $text . $after;
}
View recent_posts.php
<?php
function my_recent_posts_shortcode( $atts ) {
extract( shortcode_atts( array( 'limit' => 5 ), $atts ) );
$q = new WP_Query( 'posts_per_page=' . $limit );
$list = '<ul class="recent-posts">';
while ( $q->have_posts() ) {
$q->the_post();
View css_admin.php
<?php
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '<style>
#breedsdiv {display:none;}
</style>';
}
View add_cmb.php
<?php
if (is_admin()) {
add_action( 'init', 'cmb_showcase_load_metabox' );
}
function cmb_showcase_load_metabox() {
require_once( 'includes/metabox/example-functions.php' );
require_once( 'includes/metabox/init.php' );
View custom_post_save.php
<?php
function my_custom_save_post( $post_id ) {
// do stuff here
}
add_action( 'save_post_membros', 'my_custom_save_post' );
View recent_posts_mod.php
<?php
add_filter('widget_posts_args','modify_widget');
function modify_widget() {
$r = array( 'cat' => '6' );
return $r;
}
View snipet_ano_mes.php
<ul>
<?php
global $wpdb;
$limit = 0;
$year_prev = null;
$months = $wpdb->get_results("SELECT DISTINCT MONTH( post_date ) AS month , YEAR( post_date ) AS year, COUNT( id ) as post_count FROM $wpdb->posts WHERE post_status = 'publish' and post_date <= now( ) and post_type = 'post' GROUP BY month , year ORDER BY post_date DESC");
foreach($months as $month) :
$year_current = $month->year;
if ($year_current != $year_prev){
if ($year_prev != null){?>
View get_menu.php
<?php
$menuParameters = array(
'theme_location' => 'menu_d', // o nome do local! De quando se cria locais!
'container' => false,
'echo' => false,
'items_wrap' => '%3$s',
'depth' => 0,
);
View wp_pluck.php
<?php
$myposts = get_posts('category_name=carros&posts_per_page=1'); //exemplo de um post da categoria "Carros"
$r = wp_list_pluck( $myposts, 'ID' ); //no caso ID, pode ser outros campos
echo 'O ID do post:'.$r[0]; //usar [0]