We're merging with GenerateBlocks! Learn more here.

[Support request] Always show Image Caption Text

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Always show Image Caption Text

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #30287
    createur
    Participant

    Hi there,

    I posted this in GP Forum, but Leo said to post it here.

    We are using WP Show Post Pro for outputting posts on the front page and in the right sidebar.
    Similar to the Demo Dispatch: https://gpsites.co/dispatch/

    Our requirement is basically that we need to show the caption text of each featured image. In the single posts we already have set up with the snippet:
    https://gist.github.com/diggeddy/5f7c3a4584a8beb51febc9c4f33d6c5c

    Required still:
    – Front page with (WP Show Posts Pro)
    – Sidebar (WP Show Posts Pro)
    – Category and tag archive

    And also, when a post is shared in social Media …

    It would be great to output all captions in the upper right corner, like for example:

    View post on imgur.com

    Any chance to get help?

    Best regards.

    #30335
    elvin
    Moderator

    Hi there,

    You’ll have to hook this variable –

    $thumbnail_image = get_posts(array('p' => $post_thumbnail_id, 'post_type' => 'attachment'));

    And the conditions that follows it somewhere within your WPSP list.

    Depending on what location you placed your image, you can use these hooks.
    https://wpshowposts.com/support/topic/bbpress-metadata-and-dates-in-wpshowposts/#post-28854

    #30341
    createur
    Participant

    Thank you very much.

    Would you mind posting a complete sample hook? I am not the best in coding … 🙁

    Best regards.

    #30360
    elvin
    Moderator

    Would you mind posting a complete sample hook? I am not the best in coding …

    Where specifically do you want one?

    Here’s an example:

    add_action('wpsp_before_content',function( $settings ){
    	if( 123 == (int)$settings['list_id']){
    		$thumbnail_image = get_posts(array('p' => $post_thumbnail_id, 'post_type' => 'attachment'));
    			if ($thumbnail_image && isset($thumbnail_image[0])) {
    		
    				$image = wp_get_attachment_image_src($post_thumbnail_id, $size);
    		
    				if($thumbnail_image[0]->post_excerpt) 
    					echo '<figcaption class="wp-caption thumb-caption">'.$thumbnail_image[0]->post_excerpt.'</figcaption>';
    		
    			}
    		
    	}
    });
    #30362
    createur
    Participant

    Where specifically do you want one?

    Thank you.

    One place is like (Top right):

    View post on imgur.com

    Our WPSP Shortcode for that is:
    [wp_show_posts id=”961″]

    #30378
    elvin
    Moderator

    The image link doesn’t seem to be working.

    Can you check or post a working link? Viewing the mockup will give us a clearer idea of which hook to use. (and CSS writeup in case needed)

    #30611
    createur
    Participant

    Thank you.

    As I wrote we use same List as on
    https://gpsites.co/dispatch/

    We would need an output of Image caption text here:

    View post on imgur.com


    https://prnt.sc/13ei71q

    Thank you.

    #30643
    elvin
    Moderator

    Have you tried applying the PHP snippet provided on the previous reply here? https://wpshowposts.com/support/topic/always-show-image-caption-text/#post-30360

    Note: Make sure to change 123 with the WPSP ID of the list you want it applied on.

    Let us know if it’s activated so we can recheck the page to apply the necessary CSS to position it to your preference.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.