Skip to content

Instantly share code, notes, and snippets.

@Dianakc
Dianakc / attachment_meta.php
Created October 19, 2013 02:37
Metadados em anexos
<?php
add_filter('attachment_fields_to_edit', 'estilo_legenda_edit', 10, 2);
add_filter('attachment_fields_to_save', 'estilo_legenda_save', 10, 2);
function estilo_legenda_edit($form_fields, $post) {
$value = get_post_meta($post->ID, '_captionstyle', true);
$form_fields['captionstyle'] = array(
'label' => __('Estilo da legenda'),
'input' => 'html',
@Dianakc
Dianakc / get_names.php
Created October 19, 2013 02:34
Obtém somente o nome dos termos, sem link, separado por vírgulas
<?php
$terms = get_the_terms ($post->id, 'skills');
if ( !is_wp_error($terms)) : ?>
<?php
$skills_links = wp_list_pluck($terms, 'name');
$skills_yo = join(", ", $skills_links);
?>
<?php
$terms = get_terms("funcs");
$count = count($terms);
if ( $count > 0 ){
echo '<div id="dd" class="wrapper-dropdown-5" tabindex="1"><span class="icon-fun">Fun&ccedil;&otilde;es</span>'."\n".'<ul class="dropdown">'."\n";
foreach ( $terms as $term ) {
echo "\t\t".'<li><a href="'.get_term_link($term->name,'funcs').'">' . $term->name . '()</a></li>'."\n";
@Dianakc
Dianakc / html_cat_descs.php
Created September 14, 2013 02:16
Allow HTML in category, tags descriptions
<??php
foreach ( array( 'pre_term_description' ) as $filter ) {
remove_filter( $filter, 'wp_filter_kses' );
}
foreach ( array( 'term_description' ) as $filter ) {
remove_filter( $filter, 'wp_kses_data' );
}
@Dianakc
Dianakc / change_readmore.php
Created September 4, 2013 19:02
Modificando a classe do link "readmore"
<?php
function dkc_change morelink_class( $link, $text )
{
return str_replace(
'more-link'
,'leiamais' //removi a more-link
,$link
);
}
@Dianakc
Dianakc / fix_readmore.php
Created September 4, 2013 18:41
Resolve o problema de usar the_content('leia mais') em páginas/páginas com modelos.
<?php global $more;$more = 0;?>
<?php the_content('Leia mais'); ?>
@Dianakc
Dianakc / letter_circles.css
Created August 1, 2013 21:09
A couple of tips: If you want a bigger circle, change either font-size to enlarge everything by the same amount (both text and circle) or width, line-height and the border-radius' to only affect the circle (border-radius = half of the width and line-height values). To center the circle with other text, place it in an element where you set a line…
span.step {
background: #cccccc;
border-radius: 0.8em;
-moz-border-radius: 0.8em;
-webkit-border-radius: 0.8em;
color: #ffffff;
display: inline-block;
font-weight: bold;
line-height: 1.6em;
margin-right: 5px;
@Dianakc
Dianakc / media_queries.css
Created July 9, 2013 23:03
Media queries básica :P
@media screen and (max-width:320px) {}
@media screen and (min-width:321px) and (max-width:639px) {}
@media screen and (min-width:640px) and (max-width:959px) {}
@media screen and (min-width:960px) and (max-width:1279px) {}
@media screen and (min-width:1280px) and (max-width:1599px) {}
@media screen and (min-width:1600px) {}
@media screen and (min-width:1920px) {}
@media print {}
@Dianakc
Dianakc / featured_image_url.php
Created July 8, 2013 05:49
Obtém imagens anexadas do post, pode informar o nome do tamanho, ex. "thumbnail", "medium" etc
@Dianakc
Dianakc / hide_categories_in_the_category.php
Last active December 17, 2015 19:19
Esconde categorias do painel
<?php
function the_category_filter($thelist,$separator=' ') {
if(!defined('WP_ADMIN')) {
$exclude = array('A', 'B', 'C', 'D'); //as categorias para esconder
$cats = explode($separator,$thelist);
$newlist = array();
foreach($cats as $cat) {
$catname = trim(strip_tags($cat));
if(!in_array($catname,$exclude))