I have a custom function written to show the name of the contribution page that a PCP is a part of. After some help from the community, I got it working, hooray! Trying to write a hook to add contribution page name to Main.tpl I'm super close
But on my event registration links (not contribution pages, oddly enough) or PCP creation links - I get the following error 'CiviCRM_API3_Exception: "Expected one ContributionPage but found 25"' (I have a total of 25 contribution pages set up so I can see why it says it finds 25 but why it's looking in the first place I'm not sure.
Here is the final code I'm using
function wordpress_civicrm_buildForm($formName, &$form) {
$config = CRM_Core_Config::singleton();
if ( $config->userFrameworkFrontend ) {
$page = civicrm_api3('contribution_page', 'getsingle', array(
'id' => $form->_id,
'check_permissions' => FALSE,
'return' => 'title',
));
$form->assign('cPageName', $page['title']);
}
}
Ideas?