Wordpress: Call A Plugin Function With A Php Call?

I'm writing a Wordpress MU plugin, it includes a link with each post and I want to use ajax to call one of the plugin functions when the user clicks on this link, and then dynamically update the link-text with output from that function.

I'm stuck with the ajax query. I've got this complicated, clearly hack-ish, way to do it, but it is not quite working. What is the 'correct' or 'wordpress' way to include ajax functionality in a plugin?

(My current hack code is below. When I click the generate link I don't get the same output I get in the wp page as when I go directly to sample-ajax.php in my browser.)

I've got my code[1] set up as follows:

Plugin Name: Sample Plugin
if (!class_exists("SamplePlugin")) {...........


Call An Inside Plugin Function With A <a Href> Generated By Another Function Of This Plugin?

I'm making a little widget for my site using a search api I just made. Briefly, I want to retrieve last posts or top rated posts. I've got to tabs for that.By default, on loading, I'm on recent posts. If I click on Top posts, I'd like to call a function inside my plugin that modify a var that tell to my search API to retrieve data in the right order.I don't know if I'm very clear.. Please, take a look at my (simplified) code :

// here, i tell that by default, you have to load latest posts
var defaults = {


View 1 Replies View Related

Auto Call Function For Every Other Function Call / Call Another Function Before Any Called Function Execution?

Class test{
function test1()
echo 'inside test1';
function test2()
echo 'test2';
function test3()
echo 'test3';
$obj = new test;
$obj->test2();//prints test2
$obj->test3();//prints test3

Now my question is,

How can i call another function before any called function execution? In above case, how can i auto call 'test1' function for every another function call, so that i can get the output as,


currently i am getting output as


I cannot call 'test1' function in every function definition as there may be many functions. I need a way to auto call a function before calling any function of a class.

View 6 Replies View Related

WordPress And Call To Undefined Function Add_menu_page()?

I recently got into WordPress plugin development and I would like to add a menu page (the links in the left hand side menu). Previous SO questions and the WordPress codex say that it's as simple as calling:

add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position );

However when I try this in my plugin setup file it tells me that the function is undefined:

PHP Fatal error: Call to undefined function add_menu_page()

This seems like a very simple thing to do according to the documentation but I am totally baffled.

View 1 Replies View Related

Wordpress - Call A Function When A Comment Is Posted?

I would like to take some action in php whenever someone posts a comment. How can I set up a hook for that?I assume it would go in functions.php...EDIT - here is my udpated code:

add_action('comment_post', 'comment_posted');
function comment_posted() {
$MyClass = new MyClass(); //I do this in other functions and don't have any blank screen problems


View 1 Replies View Related

Wordpress Sidebar Error / Call To Undefined Function?

I am new to Wordpress and I have published pages on my site. I tried to get into the code of widgets.php, but stupidly, I worked on the original desktop file instead of the one on my server and I uploaded it which replaced it. I should of downloaded widgets.php from my server. I spaced out. So, now I get this error on my page:

Fatal error: Call to undefined function: get_search_form() in /home/borrowde/public_html/iremembermovies/wp-includes/widgets.php on line 771

Here is line 771 (of widgets.php):

Code: [Select]/**
* Display search widget.
* @since 2.2.0[code]....

btw~ I was originally trying to just change the amount of "Recent Posts" my page shows by following this tutorial: here.. Which I'm sure would of worked great, but I was an idiot and I probably added a 'blank' file with no recent search widget options.

My site: http:[code]....

View 6 Replies View Related

JavaScript Call A Function Directly - Separate Php File To Call The Function?

I am doing some basic Ajax stuff (not jquery.. just learning the basics), and I have a general structure set up where html calls a javascript function which sends data to and runs a specific php page.

But what if I just need to run a php function that's already defined in functions.php. Is that possible at all? I'm getting tired of making new php files for every task ;)

View 3 Replies View Related

Wordpress - Error: Call To A Member Function Set_prefix() On A Non-object?

I got this error Fatal error: Call to a member functionset_prefix() on a non-object in/home/reboltutorial/reboltutorial.com/wp-settings.phpon line 254ine 254 contains:

$prefix = $wpdb->set_prefix($table_prefix); // set up global tables

This occurs if I try to call index_wordpress() instead of calling these two lines

define('WP_USE_THEMES', true);

View 1 Replies View Related

Classes : Call A Specific Function Everytime A Method Call Is Made?

I want to call a function everytime a method call is made in PHP.

Example :
$a = new a();

View 5 Replies View Related

Oop - Call To A Member Function / Call A Method From A Singleton Class?

I'm receiving the following error message while trying to call a method from a Singleton class, inside another class. Any ideas?

Call to a member function query() on a non-object.

View 3 Replies View Related

Shortcodes Breaking Wordpress Website - Fatal Error: Call To Undefined Function Add_shortcode()

I am creating new shortcodes for Wordpress on my local version of a Wordpress website. In functions.php, I am adding for example:

function shortTest() {
return 'Test for shortcodes ';
add_shortcode('shortTestHTML', 'shortTest');

Adding the function only is OK, but when I add the add_shortcode() portion, I get a major issue. It breaks something somehow and I get 500 errors, meaning I can't even load my website locally anymore.

From PHP Error Log: [21-Jun-2011 19:02:37] PHP Fatal error: Call to undefined function add_shortcode() in /Users/jonas/Sites/jll/wp-includes/functions.php on line 4505

View 3 Replies View Related

Call A Defined Value Inside Of A Function Call?

when I run it, the defined part is nottranslated in the header function call, is there a special way to do the syntax or is this exact method not possible?

define('SITE_URL', 'http://testsddf.com');
$_SESSION['user_role'] = 0;

View 2 Replies View Related

Placing A Call To The Object Inside A Function - Call To A Member Function On A Non - Object

I've searched high and low for the solution, and have found many that don't fit the bill. The general consensus is that this happens when you've not defined your object before calling upon it's functions. That isn't the case here (I think). Placing a call to the object inside a function seems to cause this error as shown below. Anyone have a solution for this? This works!


View 5 Replies View Related

Zend Framework - Register And Call Plugin In Bootstrap File?

1- How can I register and call my plugin in bootstrap file? 2- Is it a better way to use boostrap file intead of application.ini file for registering and calling my plugins ?

Note: Iam using custom path ('Mylib/Controller/Plugin') for storing my plugins.

Actually I want to convert following 'application.ini' entries

autoloaderNamespaces[] = "Mylib_"
resources.frontController.plugins.CheckHasAccess = "Mylib_Controller_Plugin_CheckHasAccess"

into bootstrap _initPlugin function.

View 1 Replies View Related

Call Plugin In Embed Tag (linux - Mozilla) And Can It Be Called By Python

call plugin in embed tag (linux - mozilla) and can it be called by python / someone can give me a hand?

View 1 Replies View Related

Cannot Call SetNoRender() On ViewRenderer In PostDispatch() In A Zend Framework Controller Plugin

Calling setNoRender() or indeed any methods on the viewRenderer helper seem to have no effect in a controller plugin.

class TestPlugin extends Zend_Controller_Plugin_Abstract
public function postDispatch(Zend_Controller_Request_Abstract $request)
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');

The view script still renders. And the plugin is definitely running as I can put echoes in here and they will output.

View 3 Replies View Related

Wordpress Can't Find Function From Plugin?

I have installed a plugin wp-fb-autoconnect I have activated it in the dasboard. Now I would to use a function from it. In my theme folder, in one of my templates I want to add FB connect button

if( function_exists(‘jfb_output_facebook_btn’) )

function_exists(‘jfb_output_facebook_btn’) returns false. The function is located in main.php in the plugin folder and i can see it. What's wrong? UPDATE The problem in general. A plugin has declared a function. I need to get access to that function from my theme folder.

View 1 Replies View Related

Call Files In Wordpress?

I am collecting files from a directory in a wordpress blog with the PHP calling the files onto the page. Now the files come onto the page perfectly, but I was wondering is there any way to create some php that displays the files on screen in alphabetical order?

global $wpdb;

View 2 Replies View Related

Call The Wordpress Into The Iframe?

I am working on a site.

I am trying to put a constant music player and side bar to allow for constant music while the user surfs the site...

its a blog site... wordpress to be specific...

how to call the wordpress php into the iframe?

like the nav bar and main content would change but the aidebar and header will remain constant....

View 2 Replies View Related

Add Call Out Box In Wordpress Post?

how can i add call out box in wordpress post? And the content for that will be imported from a seperate Text file.

View 2 Replies View Related

Wordpress - Alter A Plugin's Function From Theme's Functions?

The code below is from the "All in One SEO" pack plugin. It alters my theme's 404 page title. I understand that's how this particular plugin works, however, in this instance, its conflicting with my theme's onboard management of 404 post titles and I need to override it.My question is, from my functions.php file, how can I intercerpt and nullify the is_404() code brance in the code below?

class All_in_One_SEO_Pack {
function rewrite_title($header) {
global $aioseop_options;


View 1 Replies View Related

Wordpress - Want To Call It From A Javascript File?

This is a file location not a script or functionality problem. I made a Wordpress theme and wanted to call a popup contact form via jQuery, if the form is validated, my js file will call a php file to send the email. Here is the file/folder structure:


I just want to know where should I place the mailer.php form, as I tried put it the same directory with the js file or in theme root or in the wordpress directory but all are not successful.

View 3 Replies View Related

Wordpress Plugin Or Quick Function For Conditional Image Size

my index.php has a body column width of about 400px The single.php has a column width of about 550px Is there a plugin or quick way to make all images (not just the post_thumbnail) display at full size (i.e., image.jpg) on single.php but use the thumbnail size (i.e., image-350x***.jpg) on index.php?

View 1 Replies View Related

Wordpress Plugin - Pass Variable From Admin Page To Function

I'm trying to add an admin panel to a wordpress plugin. It's my first attempt with working on a plugin and I don't use php frequently. My problem is getting values entered in the admin panel to where they need to be used in the function bp_tweet_button_activity_filter(). The values are saved and displayed fine on the admin page. I've been hacking it for a bit and may have added a little bit of superfluous code. I think the problem is in the beginning lines of that function, or maybe towards the beginning of the tweet_urls_menu_options function.

The plugin takes the link of an activity stream post and shortens it with a custom YOURLS url shortener, so the values needed are the username, password and url of the api for the shortener.

function bp_example_init() {
require( dirname( __FILE__ ) . '/bp-tweet-urls.php' );
define ( 'BP_TWEET_BUTTON_VERSION', '0.1' );
//Admin Menu
add_action('admin_menu', 'tweet_urls_menu');
function tweet_urls_menu() {

View 1 Replies View Related

Wordpress Plugin Add_new_post($info = Array()) Type Function?

How can I add a new blog post from wordpress plugin

View 1 Replies View Related

WordPress Plugin With TinyMCE - Use The Prepare() Function From WP And Than Store It In The Database?

I'm writing a little plugin for WordPress, which is used to create new entry's in a Notebook (also written in PHP, but not as a Plugin for WordPress). The Plugin should only create, edit and delete entry's from the Notebook (so I don't need to write a back end myself).

For the Editor, i use TinyMCE from WordPress (with the wp_tiny_mce()-function). I also use the $wpdb->prepare() function from WP to write the created entry in the Database. But the result in the Database is something like this:

Quote<p style=\"text-align: center;\">Ich bin Zentriert</p>

As you can see, escaped HTML-Code is stored in the Database and I have no idea why. I only use the prepare() Function from WP (which is used to escape code) and than store it in the Database.I first thought, Magic Quotes would maybe the Problem, but Magic Quotes isn't activated at all.The code look's like this:

global $wpdb;
Query erstellen:[code]...

View 5 Replies View Related

Call Wordpress Functions In Custom Script?

I have a Php script I want to use for creating a new blog in WPMU. I am having trouble calling wordpress functions like "wpmu_create_user" and "wpmu_create_blog".

My hope is to get this script running as a cron job from command line and pick up new blog creation requests from an external db, create a new blog using the wordpress functions and update the db with new blog info.

View 3 Replies View Related

CURL Call Fails To A Wordpress RSS Feed?

I'm trying to do a CURL call to an RSS feed from a wordpress, I'm not using simplexml_load_file() because it's forbiden by php.ini to do such calls, so I'm trying to get the xml via CURL, so far it works for any URL but not for wordpress RSS feeds, even if they are on the same server.

If I access the Feed URL directly on my browser i can see the XML, but the server is failing, im trying the following

$url = "http://www.legrandjournal.com.mx/category/actu-monde/feed/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);


View 1 Replies View Related

Wordpress - Call In Sidebar From Another Blog Within Site?

I have multiple installations of wordpress installed since every link is going to be in blog format.I would like to set it up where I can use the sidebar from this page: http:[url]... all the other pages such as the home page: http:[url]...I went into the home's sidebar.php file and added the following code:

PHP Code:


This did not work. It pulled in the most recent posts, etc. from the current install. I want it to pull it in from the "blog page" install.

View 1 Replies View Related

Call SOAP Method Via CURL In Call Require Client Authentication?

OVERVIEW: The code is about making call to the escreen web service using SOAP and Curl with client authentication required. Currently I am not getting any result only HTTP 403 and 500 errors. The call requires client authenticate cert to be on the callng site.

$content = "<TicketRequest>

If I comment out as above and also CURLOPT_SSLCERT and CURLOPT_SSLCERTPASSWD it gives 403 error with the message as content. So I would request you to help me out by pointing out whats wrong with the current code.

View 1 Replies View Related

Call SOAP Method Via CURL In It - Call Require Client Authentication

The code is about making call to the escreen web service using SOAP and Curl with client authentication required. Currently I am not getting any result only HTTP 403 and 500 errors. The call requires client authenticate cert to be on the callng site.

$content = "<TicketRequest>


1. I need to call the RequestTicket method and pass the XML string to it. I don't know how to do it here(pass the method name to call).

2. For client authentication they gave us three certs, one root cert, one intermediate cert and a client authentication cert PROTPLUSSOL_SSOpem(it was a .pfx file). Since we are on linux we converted them to pem . In curl calls I could not find way to how to include both the root cert and the intermediate cert ,so I combined them by making a new pem file and copying the intermediate cert and them the root cert and naming it authority.pem. I am not sure whether it works or not and would like your opinion.

3. For the current code Iam getting the error Error no : 77 Curl error: error setting certificate verify locations: CAfile: /home/pps/authority.pem CApath: /home/pps/......

View 2 Replies View Related

Copyrights 2005-15 www.BigResource.com, All rights reserved