Hi,
Thank you for your quick response.
You’re right, I’m using one of your snippets to filter the output and add the custom field. Although, i recently changed it to show the title of the parent page instead of the custom field, but it mainly the same snippet.
add_filter( 'display_posts_shortcode_output', 'be_display_posts_custom_fields', 10, 6 );
function be_display_posts_custom_fields( $output, $atts, $image, $title, $date, $excerpt ) {
// Get our custom fields
global $post;
//H?r h?mtade den custom fields fr?n posten, den ?ndrade jag s? den h?mtar parent page title...
/*$adress = esc_attr( get_post_meta( $post->ID, 'adress', true ) );*/
$parent = get_post($post->post_parent);
$adress = $parent->post_title;
// If there's a value for the custom field, let's wrap them with <span>'s so you can control them with CSS
if( isset( $adress ) ) $adress = '<span class="vara-fastigheter-adress">' . $adress . '</span> ';
// Now let's rebuild the output.
$output = '<li class="vara-fastigheter-container"><div class="vara-fastigheter-left"><div class="vara-fastigheter-image">' . $image . '</div><div class="vara-fastigheter-title-area">' . $title . '</div><div class="vara-fastigheter-ort">' . $adress . '</div><div class="vara-fastigheter-utdrag">' . $excerpt . '</div>';
// Finally we'll return the modified output
return $output;
}
Thank you!