CodeIgniter Forums
WordPress Connector - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Addins (https://forum.codeigniter.com/forumdisplay.php?fid=34)
+--- Thread: WordPress Connector (/showthread.php?tid=77865)



WordPress Connector - MGatner - 10-28-2020

Hi all- I have a pretty interesting but niche module to share with you, compliments of an employer who likes to support open-source software.
If you're like me you would love to spend all our time in CodeIgniter, but those constant requests for "help with my website" keep landing you back in WordPress (bless its little heart).
Well what if I told you that you could work on a WordPress site in CodeIgniter? Look no further!

Tatter\WordPress
WordPress content management for CodeIgniter 4
https://github.com/tattersoftware/codeigniter4-wordpress

Tatter\WordPress is a module you may add to any CodeIgniter 4 app to allow it to connect to and work with an existing WordPress installation. The library comes with the Reader class, a parser designed to read configuration values from WordPress' wp-config.php file. By extracting database information and installation path, Tatter\WordPress can connect to the same database and work with its content. An example addition to your Database config:
PHP Code:
class Database extends BaseConfig
{
    public 
$wordpress = [
        
'DBDriver' => 'Tatter\WordPress\Database',
        
'WPConfig' => '/path/to/wp-config.php',
    ]; 

Once you have a successful connection, you may use the modules's Models and Entities corresponding to WordPress's database tables to make changes. This initial release includes full support for "wp_posts" (that was the scope needed for my current project) but support for more tables will be added over time and on request.

View and install the package from Packagist or provide feedback, bug reports, and requests at GitHub.


RE: WordPress Connector - {e}aksquad - 10-30-2020

Wow. The stuff that you put together never ceases to amaze me. Thanks for sharing this!


RE: WordPress Connector - MGatner - 10-31-2020

<3 thanks friend. I’m always pleased when something I’m working on can be shared with the larger community