wordpressigniter icon indicating copy to clipboard operation
wordpressigniter copied to clipboard

How to use WP function inside CI Controller or CI View

Open hakimny opened this issue 9 years ago • 4 comments

Hi Dan

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

Thx Hakim

hakimny avatar May 06 '15 20:05 hakimny

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.

dynamodan avatar May 07 '15 16:05 dynamodan

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

hakimny avatar May 07 '15 16:05 hakimny

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.

dynamodan avatar May 07 '15 17:05 dynamodan

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

hakimny avatar May 07 '15 17:05 hakimny