title: How do I add an onclick event to the Wordpress wp_list_pages function?
body: <p>My goal is to have the page scroll to the right or left when you click on a page link so the content smoothly slides onto the screen.</p>
  
  <p>Here's what the html would look like to make this work:</p>
  
  <pre><code>&lt;li&gt;&lt;a href="#" onclick="selectPage(1); return false;" class="page-item c"&gt;&lt;span class="current-page page-hover"&gt;Home&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#" onclick="selectPage(2); return false;" class="page-item"&gt;&lt;span&gt;About&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#" onclick="selectPage(3); return false;" class="page-item"&gt;&lt;span&gt;Porfolio&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#" onclick="selectPage(4); return false;" class="page-item"&gt;&lt;span&gt;Contact&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>But I want the navigation menu to be dynamic. So I use this instead:</p>
  
  <pre><code>&lt;?php wp_list_pages( array( 
  'title_li' =&gt; '', 
  'depth' =&gt; 1,
  'link_before' =&gt; '&lt;span&gt;',
  'link_after' =&gt; '&lt;/span&gt;'
  )); ?&gt;
  </code></pre>
  
  <p>How do I add the onclick function into the anchor tags though? I'm new to php and need help figuring out how to do this. Thanks, I really appreciate your time.</p>