Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author WPCharitable

    (@wpcharitable)

    Hi Yael,

    The content-campaign.php is the one that defines the template for the campaign page. But it’s a hook-based template, so what you actually want is a way to change which hooks are called at which points.

    The best place to look for this is in includes/public/charitable-template-hooks.php. If you scroll down you will see that there are a lot of comments throughout the file to explain what each section is doing. And you will see lines of code like this:

    add_action( 'charitable_campaign_content_before', 'charitable_template_campaign_description', 4 );
    add_action( 'charitable_campaign_content_before', 'charitable_template_campaign_summary', 6 );

    This particular example shows that the campaign description and stats summary are added before the campaign content. To switch their order, you could add this to your theme’s functions.php file:

    remove_action( 'charitable_campaign_content_before', 'charitable_template_campaign_description', 4 );
    add_action( 'charitable_campaign_content_before', 'charitable_template_campaign_description', 8 );

    That’s just a very simple example, but hopefully it’s helpful in showing how to modify the campaign page.

    Cheers,
    Eric

    Thread Starter Yael Reinhardt-Matsliah

    (@kalanit)

    Yes, that solves the mystery! This helps a lot!

    Thanks.

    Thread Starter Yael Reinhardt-Matsliah

    (@kalanit)

    HI Eric,

    Just to confirm the example you provided should move the Campaign Summary below the campaign content? I’ve added to functions.php file but no changes are happening.

    I’ve hidden the campaign description via CSS and want the campaign content first, then below that the campaign details with option to Donate.

    I’m trying to sort through all the hooks but I’m just not sure.

    Thanks, yael

    Thread Starter Yael Reinhardt-Matsliah

    (@kalanit)

    to clarify, I want Brief Bio and content at top of page, and the campaign details (box showing at top) to be below the content.

    https://dekalbalphas.org/campaigns/christian-bernard/

    Plugin Author WPCharitable

    (@wpcharitable)

    Hi Yael,

    Ah, gotcha. So to move the campaign summary from before the content to after the content, you need to ‘unhook’ it from the charitable_campaign_content_before hook and then attach it to the charitable_campaign_content_after hook:

    remove_action( 'charitable_campaign_content_before', 'charitable_template_campaign_summary', 6 );
    add_action( 'charitable_campaign_content_after', 'charitable_template_campaign_summary', 2 );

    That should be all you need to do.

    Cheers,
    Eric

    Thread Starter Yael Reinhardt-Matsliah

    (@kalanit)

    okay, so at least I was thinking correctly but I just wasn’t entirely sure. It’s entirely logical but thank you for helping my cloudy though process!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Which template file for actual campaign’ is closed to new replies.