Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active August 21, 2018 02:57
Embed
What would you like to do?
<?php
/**
* Display Posts Shortcode - Move image after title
* @see https://www.billerickson.net/code/using-display-posts-shortcode-output-filter
*
*/
function be_dps_move_image_after_title( $output, $original_atts, $image, $title, $date, $excerpt, $inner_wrapper, $content, $class, $author, $category_display_text ) {
$output = '<' . $inner_wrapper . ' class="' . implode( ' ', $class ) . '">' . $title . $image . $date . $author . $category_display_text . $excerpt . $content . '</' . $inner_wrapper . '>';
return $output;
}
add_filter( 'display_posts_shortcode_output', 'be_dps_move_image_after_title', 10, 11 );
@seryi27
Copy link

seryi27 commented Aug 16, 2018

Hi, when adding this same code to my functions.php (i am just trying to change the order of the elements) and refreshing my page this message pops up:
"Fatal error: Uncaught ArgumentCountError: Too few arguments to function be_dps_move_image_after_title(), 9 passed in C:\xampp\htdocs\wordpress\wp-includes\class-wp-hook.php on line 286 and exactly 11 expected in C:\xampp\htdocs\wordpress\wp-content\themes\understrap-child\functions.php:" Could you help me?

@reqdev
Copy link

reqdev commented Aug 21, 2018

Same error here as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment