WordPress path url in js script file

According to the WordPress documentation, you should use wp_localize_script() in your functions.php file. This will create a Javascript Object in the header, which will be available to your scripts at runtime. See Codex Example: <?php wp_localize_script(‘mylib’, ‘WPURLS’, array( ‘siteurl’ => get_option(‘siteurl’) )); ?> To access this variable within in Javascript, you would simply do: <script … Read more

How to integrate WordPress template with CodeIgniter

First step is to move CodeIgniter and the WordPress files in their own directory. After that, put the following line at the top of your CodeIgniter’s index.php file. Change the path to wp-blog-header.php as needed to point to your WordPress’s root directory. <?php require(‘../wp-blog-header.php’); Then, you can use the following functions inside your views: <?php … Read more

How can I get the current page name in WordPress?

The WordPress global variable $pagename should be available for you. I have just tried with the same setup you specified. $pagename is defined in the file wp-includes/theme.php, inside the function get_page_template(), which is of course is called before your page theme files are parsed, so it is available at any point inside your templates for … Read more