WordPress.org

Ready to get started?Download WordPress

Forums

Personal Fundraiser
[resolved] Cause Image Shortcode or URL (4 posts)

  1. steckinsights
    Member
    Posted 1 year ago #

    John,

    Is there a way to reference the cause image? I can use [pfund-image] for campaign images, but it doesn't seem to be working for the cause.

    I'm pulling in a custom template into the header that references the cause's image and I'm not able to grab it (is that because it's not technically in the loop? Shouldn't "global $post;" fix that?)

    Thanks!

    http://wordpress.org/extend/plugins/personal-fundraiser/

  2. steckinsights
    Member
    Posted 1 year ago #

    Solved this problem using the following code:

    <?php
    add_action('genesis_after_post_title', 'cause_header');
    function cause_header( $field_options ) {
    	global $post;
    	$cause_image = get_post_meta( $post->ID, '_pfund_cause_image', true );
    	echo '<img class="pfund-image cause-header" width="625" src="'.wp_get_attachment_url( $cause_image ).'">';
    }
    
    ?>

    A few disclaimers: I'm using the Genesis Framework from StudioPress, so the add_action is using a Genesis hook... regardless, you should be able to use the code.

    Class and Width are arbitrary; modify those as needed.

    This code could probably be improved with an "if" statement, but this is doing the trick for me. Hope it helps someone else who is trying to access the pfund image from external PHP.

  3. alriq1211
    Member
    Posted 1 year ago #

    Is your problem the same as mine? If so and your code will solve it, where exactly do I place the code specifically?

    When you go to a cause and create a campaign it shows up with a user image.

    On a page named Campaigns i added the code [pfund-campaign-list]. What shows up on the page is (.Travel) Travel being the name of the Cause which is a link and a dot in front of it. When you click the link you see the Campaign with the user image.

    What I would like to see is the actual Campaign with the user image displayed on the page directly without seeing and having to click the (.Travel)Cause title link.

    How do i do this?

  4. steckinsights
    Member
    Posted 1 year ago #

    @alriq1211,

    From what I can tell, you're simply trying to display your campaign. If that's the case, and my memory serves me right, the shortcode should be: [pfund-campaign]

    [pfund-campaign-list] will create a list of existing campaigns, which is why you're getting a link to your "Travel" campaign.

    Let me know if I misunderstood you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.