I need to put some code right before the comments section on a static Wordpress page (those that have links in the main menu) -- which php file do I have to edit and where should the code go? Many thanks!
If it is on the index or home page, edit index.php or if it is for single post page, edit single.php... make sure you are editing these of the templates and not the wordpress as it is Go to theme editor to make it done easily..!
It is neither the home page nor a post -- it is a new page created with Pages --> add new. I need to put code before the comments just for this page. It must not affect any other page. Thanks!
The page template file is page.php, but the comment section is in comments.php file. So, I guess the file you need to edit is comments.php. To show code in only static page, use the condition: <?php if (is_page()) { // your code here } ?> PHP:
What kind of code. If it's javascript you might try inserting it in the HTML mode rather than visual. Or if it's a php script you can try: http://wordpress.org/extend/plugins/exec-php/ Just use it on the page you want to edit rather than a template.