Support » Plugins » Hacks » calling a custom function

  • Hi guys, I have been coding a little bit in wordpress now, but I need to be able to call a custom function and I still can’t get it right.

    I made a plugin with the base ingredients like cubepoints.
    this plugin has a function that I like to be called when a user “likes” a post. (actually posts are jobs and the user applies for that job, but in essence it should do the same)

    The function itself adds the post id to the user’s metadata for future reference.

    I edited the theme to incorporate an “apply for this job” button and I tried to make a page that just calls the function and returns you to the page you came from, but the problem I have is that this completely empty page doesn’t know where the wordpress DB is, it doesn’t know where the includes are and not even if this user is logged in and has the rights to execute the function.

    Although I have a strong feeling that I should ajax for these kind of functions, I think that even using ajax I will face the sme problems.

    Could anyone please point me in the right direction? this must be something basic, but I can’t find it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The way you are going about this isn’t ideal, but you probably just need to include wp-blog-header.php in that new page.

    Thanks for the tip markparolisi. That could be a solution I guess.

    I learned yesterday that making a page to call and adding a new template to that page can help. I then can just call my functions in the template. Should I then $_GET all parameters to the page?

    What would be the ideal way?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘calling a custom function’ is closed to new replies.