New answers tagged

0

i had sort out this with function get_post_gallery find the answer if ( ! function_exists( 'flexi_gallery_slideshow' ) ) : /** * Display an optional post read more link * */ function flexi_gallery_slideshow( ) { echo '<ul class="bxslider">'; if ( get_post_gallery() ) : $gallery = get_post_gallery( get_the_ID(), false ); /* Loop ...


0

Every post has a maximum of one format and one status. To echo the format you need: if (get_post_format($post->ID)) echo '<span class="format-' . get_post_format($post->ID); . '"></span>'; To echo the status you need this: if (get_post_status($post->ID)) echo '<span class="status-' . get_post_status($post->ID); . ...


-1

<span class="<?php echo get_post_format_string('video'); ?>"></span> <span class="<?php echo get_post_format_string('status'); ?>"></span> It will use post format as a class. You can check all post format string through this code function get_post_format_strings() { $strings = array( 'standard' => _x( ...


1

You can also try <span class="<?php echo get_post_format($post->ID); ?>"></span> Additional details available here Edited from here: Well according to the link I provided, get_post_format() give you the post format post the post_type post. So if you want to use it in loop, you could try while ( have_posts() ) : the_post(); echo ...


0

The best way to do this is get the post format and then use the switch statement, like this: $my_format = get_post_format (); switch ($my_format) { case 'quote': $htmlcontent = ... ; break; case 'aside': $htmlcontent = ... ; break; and so on } The function that builds up $htmlcontent starts with declaring some building blocks that are used ...


0

Looking at your list, you are really only changing the default result for excerpts for the image and quote formats (at the moment), you can remove those using the_excerpt filter... add_filter('the_excerpt','custom_post_format_excerpt',99); function custom_post_format_excerpt() { $noexcerptformats = array('quote','image'); if ...


0

Will it cause any problems if I use get_template_part() like this? I can't really see any answer other than... no. But that's based on not knowing what you actually mean by "problems". If you mean "is this code totally bulletproof no matter what scenario you could possible throw at it" then yes, it may cause problems - I don't think you can cover for ...



Top 50 recent answers are included