Answers.Body: <p>Solution found:
  <a href="https://docs.civicrm.org/dev/en/latest/hooks/usage/wordpress/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/hooks/usage/wordpress/</a></p>
  <pre><code>add_filter('civicrm_pageRun', 'addJoinLink', 10, 4 );
  
  function addJoinLink() {
      CRM_Core_Region::instance('event-page-eventinfo-actionlinks-top')-&gt;add(array(
          'markup' =&gt; '&lt;p&gt;Congratulations! You won the lottery!&lt;/p&gt;',
      ));
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-17T17:22:10.913Z
Answers.LastActivityDate: 2021-12-17T17:22:10.913Z
Answers.UserDisplayName: dsmith63
Answers.Body: <p>You need to implement it in hook, if you are looking to add content on event info page than you will need to implement it in pageRun() hook</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-17T17:10:51.543Z
Answers.Text: Do I need to make an extension that uses the "pageRun" hook or can I declare the hook elsewhere like in my theme's functions.php file?
Answers.UserDisplayName: dsmith63
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-18T12:45:25.280Z
Answers.Text: You create an extension or use add_filter in your plugin or theme
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-17T16:06:45.620Z
Answers.LastActivityDate: 2021-12-17T16:06:45.620Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I'm wanting to add content to a region in EventInfo.tpl. The <a href="https://docs.civicrm.org/dev/en/latest/framework/region/" rel="nofollow noreferrer">Docs</a> give this function as an example, but do not clarify exactly where this &quot;CRM_Core_Region::instance('page-body')-&gt;add&quot; method is called from.</p>
  <pre><code>  CRM_Core_Region::instance('page-body')-&gt;add(array(
        'markup' =&gt; '&lt;p&gt;Congratulations! You won the lottery!&lt;/p&gt;',
    ));
  </code></pre>
  <p>Can I call this method from within a theme file like functions.php? Is there a predefined directory where custom region code should live?</p>
  
Tags: <civievent><templates><custom-templates>
Title: Where should custom "Region" calls be stored?
ThreadText: # Where should custom "Region" calls be stored?
  
  (Asked by: username_0 on 2021-12-17)
  
  I'm wanting to add content to a region in EventInfo.tpl. The Docs give this function as an example, but do not clarify exactly where this "CRM_Core_Region::instance('page-body')->add" method is called from.
    CRM_Core_Region::instance('page-body')->add(array(
        'markup' => 'Congratulations! You won the lottery!',
    ));
  
  Can I call this method from within a theme file like functions.php? Is there a predefined directory where custom region code should live?
  
  **Tags:** civievent, templates, custom-templates
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2021-12-17. Score: 3
  
  Solution found:
  https://docs.civicrm.org/dev/en/latest/hooks/usage/wordpress/
  add_filter('civicrm_pageRun', 'addJoinLink', 10, 4 );
  
  function addJoinLink() {
      CRM_Core_Region::instance('event-page-eventinfo-actionlinks-top')->add(array(
          'markup' => 'Congratulations! You won the lottery!',
      ));
  }
  
  
  ---
  
  ### Answer by username_1 on 2021-12-17. Score: 1
  
  You need to implement it in hook, if you are looking to add content on event info page than you will need to implement it in pageRun() hook
  
  > **Comments:**
  > **username_0**: Do I need to make an extension that uses the "pageRun" hook or can I declare the hook elsewhere like in my theme's functions.php file?  
  > **username_1**: You create an extension or use add_filter in your plugin or theme  
  
  ---
  
  