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.
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?
@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.