dynamodan / wordpressigniter

A WordPress plugin that integrates CodeIgniter
GNU General Public License v2.0
27 stars 24 forks source link

How to use WP function inside CI Controller or CI View #10

Open hakimny opened 9 years ago

hakimny commented 9 years ago

Hi Dan

Is there a way to use wp functions inside inside CI Controller or CI View.

Thx Hakim

dynamodan commented 9 years ago

Some of them, yes. Not all the wordpress functions are instantiated when CodeIgniter runs. There's a document titled "Make sense of WP core load" (google it) that you should study. It's important to know when in WordPress' execution that CodeIgniter runs through its loop. I can't say exactly which ones run.

hakimny commented 9 years ago

Do you have an example on how to run WP_Query() , I would like to run it on some CI Views

thx for any help you can provide.

thx Hakim

dynamodan commented 9 years ago

I don't have an example. When in CodeIgniter, I tend to use CodeIgniter's active record facilities. The reason that I developed this plugin was to integrate a lot of existing code, models, libraries and such that are specifically intended for CodeIgniter, and serve them up within a WordPress context. I'm sorry that there's not more readily available WordPress parts within the CodeIgniter context.

hakimny commented 9 years ago

Thx Dan I was able to see what is available when Wrodpress loads by running var_dump(get_defined_functions()); thx Hakim