Codex tools: Log in
Languages: English • Español • 日本語 • (Add your language)
Contents |
Devuelve el formato (post format) de una entrada o post. Generalmente será llamado en el loop, pero puede ser usado en cualquier lugar si se proporciona un ID de entrada o post.
<?php $format = get_post_format( $post_id ); ?>
Template:Devuelve Los formatos actualmente definidos son:
Ten en cuenta que el formato por defecto (una entrada o post normal) también devuelve false, pero esto es así para hacer también referencia en cualquier momento al formato 'standard'. En algunos casos, los desarrolladores pueden querer hacer una comprobación del tipo:
$format = get_post_format(); if ( false === $format ) $format = 'standard';
<?php /* * Pull in a different sub-template, depending on the Post Format. * * Make sure that there is a default '<tt>format.php</tt>' file to fall back to * as a default. Name templates '<tt>format-link.php</tt>', '<tt>format-aside.php</tt>', etc. * * You should use this in the loop. */ $format = get_post_format(); get_template_part( 'format', $format ); ?>
get_post_format() está localizado en wp-includes/post.php.
Post Formats: set_post_format(), get_post_format(), has_post_format(), the_post_format_audio(), get_the_post_format_media(), get_content_audio(), the_post_format_chat(), get_the_post_format_chat(), get_content_chat(), add_chat_detection_format(), the_post_format_gallery(), get_content_galleries(), get_post_gallery_images(), the_post_format_image(), get_the_post_format_image(), get_content_images(), the_post_format_quote(), get_the_post_format_quote(), get_content_quote(), the_post_format_url(), get_the_post_format_url(), get_content_url(), the_post_format_video(), get_content_video(), the_remaining_content(), get_the_remaining_content(), get_post_format_meta(), post_format_content_class(), get_post_format_content_class(), post_formats_compat()