Alcarver
Gamma
Verificación en dos pasos activada
Verificado por Whatsapp
Hola,
En mi blog con Thesis Theme estoy utilizando el siguiente código para mostrar el botón me gusta al principio y al final de cada post:
PERO hay una categoría (número 8) en la que quiero que se muestre el botón sólo al principio del post.
Una de las respuestas que me han dado es:
"You can create a condition (expand it) for the above that excludes from the above function && (!in_category('8')){ as described in the WP Codex on conditionals here. Then you could sort of do the reverse to get a function that says only if you are in category 8's posts then (same thing, different hook). You'd only use one add_action on that second function, since you only want the like before, but not after, the posts in that category."
😕
Soy más que novato en estos códigos y me están creciendo canas intentando hacerlo yo mismo.
Podéis ayudarme, Betas, por favor? :sorrow:
En mi blog con Thesis Theme estoy utilizando el siguiente código para mostrar el botón me gusta al principio y al final de cada post:
Insertar CODE, HTML o PHP:
function fb_like() {
if (is_single()) { ?>
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&layout=standard&show_faces=false&width=450&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:60px;"></iframe>
<?php }
}
add_action('thesis_hook_after_post','fb_like');
add_action('thesis_hook_before_post','fb_like');
PERO hay una categoría (número 8) en la que quiero que se muestre el botón sólo al principio del post.
Una de las respuestas que me han dado es:
"You can create a condition (expand it) for the above that excludes from the above function && (!in_category('8')){ as described in the WP Codex on conditionals here. Then you could sort of do the reverse to get a function that says only if you are in category 8's posts then (same thing, different hook). You'd only use one add_action on that second function, since you only want the like before, but not after, the posts in that category."
😕
Soy más que novato en estos códigos y me están creciendo canas intentando hacerlo yo mismo.
Podéis ayudarme, Betas, por favor? :sorrow:

