develophper
develophper

Reputation: 312

Wordpress Get URL Footer File

I need to access the footer inside a wordpress theme via a url. Ideally it would just render the footer data and nothing else, alternative suggestions welcomed though.

To add some context, the data will be fetched through the url and a script will read the markup. This data will then be cached and available through Magento where it is needed to be displayed..

Is there a url path that will display it or should I make a new page that can be called via the base-url+the-page-name???

Upvotes: 0

Views: 702

Answers (3)

Merijndk
Merijndk

Reputation: 1693

what you can do is make a wordpress custom page template.

If you dont know how heres a little tutorial : http://www.expand2web.com/blog/custom-page-template-wordpress/

Now you want the custom page template to only load the footer (add the html, head and body opening tags yourself)

if you create a new page with your page template seletced it will only output the footer.

Hope you can get it to work

Greetings

merijn

Upvotes: 1

Igor Yavych
Igor Yavych

Reputation: 4228

What about $footer_url=get_template_directory_uri().'/footer.php'; ?

Upvotes: 0

chrisguitarguy
chrisguitarguy

Reputation: 2369

There's nothing built in to do that. You could use the AJAX API in your theme or a plugin and accomplish it.

You hook into an action that gets sent as a URL or POST data parameter and then make a request to yoursite.com/path/to/wordpress/wp-admin/admin-ajax.php.

<?php
add_action('wp_ajax_so20495429_display_footer', 'so20495429_display_footer');
add_action('wp_ajax_nopriv_so20495429_display_footer', 'so20495429_display_footer');
function so20495429_display_footer()
{
    get_footer('ajax');
}

This will work for all users, logged in or not, despite the wp-admin URL. Here is code above wrapped up in a plugin.

Upvotes: 3

Related Questions