WordPress.org

Ready to get started?Download WordPress

Forums

Image Credits
[resolved] get function stops page render (5 posts)

  1. jeffreyd000
    Member
    Posted 11 months ago #

    Hi,
    I just installed the plugin, great idea!
    I want to have the credit show below the featured image. I edited single.php to include: <?php get_image_credits(); ?>

    When I check the site the page stops rendering right where that is supposed to show up.

    Do I have a syntax error? Do I need to leave the functions call in functions.php for the plugin to work?

    BTW: The plugin did work when I only had the code in functions.php but it was just too low on the page. Right below the featured image is the sweet spot!.

    Thanks,
    Jeffrey

    http://wordpress.org/plugins/image-credits/

  2. Adam Capriola
    Member
    Plugin Author

    Posted 11 months ago #

    get_image_credits() only returns the image credits, so you might need to do echo get_image_credits();.

    If that doesn't work, then I might have an idea as to why it's stopping the page render.

    What theme are you using by the way?

  3. jeffreyd000
    Member
    Posted 11 months ago #

    I'll give it a go. Thanks.
    Theme = Responsive from Cyberchimps

  4. jeffreyd000
    Member
    Posted 11 months ago #

    Solved with <div class="image-credits"><?php echo do_shortcode("[image-credits]"); ?></div>

  5. Adam Capriola
    Member
    Plugin Author

    Posted 11 months ago #

    Great! I'm still not quite sure why the page stopped rendering, but I'm happy you got it working. Normally I filter the the_content to add the image credits like this:

    /**
     * Image Credits on Posts
     *
     */
    add_filter( 'the_content', 'ac_image_credits' );
    
    function ac_image_credits( $content ) {
    
    	if ( is_singular( 'post' ) ) {
    
    		$content .= '<p>[image-credits]</p>';
    
    	}
    
    	return $content;
    
    }

    That adds the credits to the end of a post. If you wanted them at the beginning, you could do $content = '<p>[image-credits]</p>' . $content;.

Reply

You must log in to post.

About this Plugin

About this Topic