RSS

[wordpress][tutorial km tip] How to Call plugin function at front end? How to display record listing at front end?

04 Nov

To hook any plugin function at back end, following code is there

add_action('admin_menu', 'action_here');
function action_here() {
add_users_page('Customized Functionality', 'Customized Functionality', 'administrator',
'action_here', 'action_here_function_call');
}
function  action_here_function_call()
{
// functionality definition here.
}

But how to hook  action_here_function_call() at front end without modifying theme.
As in drupal we have ‘Pages’ which execute php code when ‘PHP Filter’ module is enabled, i need the same in wordpress, but wordpress didn’t filter php code by default.
Then I get Exec-PHP plugin, when it get activated any php code in post, pages etc get executed.

Simply create new wordpress page ({base_url}wp-admin/post-new.php?post_type=page) and paste following code in html view:

<?php

action_here_function_call()

?>

Through Custom Menu ({base_url}wp-admin/nav-menus.php) customized tab for the page can be created.
Following are few considerations while executing php code through Exec-PHP plugin:
1) Try to avoid php tags <?php ?> within the function as much as you can, because i observed that tags, within the particular function called at front end, break the code.
2) Avoid extra spaces in javascripting. If there is any js in your function then to execute it remove extra spaces.

Have a nice learning with opensource cms 🙂

Advertisements
 
Leave a comment

Posted by on November 4, 2011 in wordpress

 

Tags: , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: