PHP code example of isotopsweden / wp-cargo

1. Go to this page and download the library: Download isotopsweden/wp-cargo 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/ */

    

isotopsweden / wp-cargo example snippets


cargo()->set_config( [
  'content' => [
    'options' => ['siteurl', 'home']
  ],
  'database' => [
    'driver' => 'mysql',
    'mysql'  => [
      'table' => 'wp_cargo'
    ]
  ],
  'preview' => [
    'fields' => ['post_id' => 'ID', 'post_type'],
    'url'    => 'http://example.com/_preview'
  ],
  'pusher'   => [
    'driver' => 'http',
    'http'   => [
      'url' => 'http://localhost:9988'
    ]
  ]
] );

add_filter( 'cargo_prepare_meta_value', function ( $object_id, $slug, $value, $type ) {
  return $value;
}, 10, 4 );

add_filter( 'cargo_modify_content_data', function ( $data, $type ) {
  return $data;
}, 10, 2 );