PHP code example of gwa / wp-bridge

1. Go to this page and download the library: Download gwa/wp-bridge library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gwa / wp-bridge example snippets


$bridge = new \Gwa\Wordpress\WpBridge\WpBridge();

use Gwa\Wordpress\WpBridge\Traits\WpBridgeTrait;

class TestClass
{
    use WpBridgeTrait;

    public function testFunc()
    {
        $img = $this->getWpBridge()->wpGetAttachmentImageSrc(...);

        ...
    }
}

$test = new TestClass();
$test->setWpBridge($bridge);
 php
// To call
wp_get_attachment_image_src(...);

// use
$bridge->wpGetAttachmentImageSrc(...);