• Hello!
    I have a problem with this plugin concerning displaying a custom field of a post.

    Is there a possibilty to show the custom field with the thumbnail and the excerpt?

    I’ve tried to add it in the plugin code, but I’m not that familiar with php to get it into the code. I wanted to integrate it somewhere here: (functions-php)

    `// Recent posts wrapper
    $html = ‘<div ‘ . ( ! empty( $args[‘cssID’] ) ? ‘id=”‘ . sanitize_html_class( $args[‘cssID’] ) . ‘”‘ : ” ) . ‘ class=”rpwe-block ‘ . ( ! empty( $args[‘css_class’] ) ? ” . sanitize_html_class( $args[‘css_class’] ) . ” : ” ) . ‘”>’;

    $html .= ‘<ul class=”rpwe-ul”>’;

    while ( $posts->have_posts() ) : $posts->the_post();

    // Thumbnails
    $thumb_id = get_post_thumbnail_id(); // Get the featured image id.
    $img_url = wp_get_attachment_url( $thumb_id ); // Get img URL.

    // Display the image url and crop using the resizer.
    $image = rpwe_resize( $img_url, $args[‘thumb_width’], $args[‘thumb_height’], true );

    // Start recent posts markup.
    $html .= ‘<li class=”rpwe-li rpwe-clearfix”>’;`

    Can anybody help me to get this work?

    Thank you very much in advance!

    • This topic was modified 7 years, 3 months ago by xJulex.
Viewing 1 replies (of 1 total)
  • wp-content/plugins/recent-posts-widget-extended/includes/functions.php and code above line 216 ($html .= '</li>';)

    format:

    if ( get_post_meta( get_the_ID(), 'custom-text', true ) ) :
    	$html .= '<p>';
    		$html .= get_post_meta( get_the_ID(), 'custom-text', true );
    	$html .= '</p>';
    endif;

    custom-text (x2) – name
    <p> and </p> – html tag, You can add id/class and css

Viewing 1 replies (of 1 total)
  • The topic ‘show custom field’ is closed to new replies.