I am trying to implement a sidebar in my wordpress website, it is currently static but I want it to be dynamic.
What I want exactly is for the page to check 'on page load' whether that particular page has sub-pages or not. If yes then it should display a sidebar on the right showing all sub pages under the current page.
I can implement this in normal PHP. but, I don't know how to do in wordpress.
I am new to wordpress. so ,I really do not know how to go about this.
This is the sidebar I want to display:
<div class="sidebar">
<h2>In This Section</h2>
<ul>
<li style="list-style:none"><h3><a href="#">Sub Page 1</a></h3></li>
<li style="list-style:none"><h3><a href="#">Sub Page 2</a></h3></li>
<li style="list-style:none"><h3><a href="#">Sub Page 3</a></h3></li>
</ul>
<br />
</div>