1. Go to this page and download the library: Download tfrommen/external-content 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/ */
tfrommen / external-content example snippets
/**
* Filter the post type args.
*
* @param array $args Post type args.
*/
add_filter( 'external_content_args', function( $args ) {
// Use hierarchical external content
$args[ 'hierarchical' ] = TRUE;
return $args;
} );
/**
* Filter the post type description.
*
* @param string $description Post type description.
*/
add_filter( 'external_content_description', function() {
// Provide a description
return 'Simple post type for handling external content like any other post.';
} );
/**
* Filter the post type labels.
*
* @param array $labels Post type labels.
*/
add_filter( 'external_content_labels', function( $labels ) {
// A little more horror, please...
$labels[ 'not_found' ] = 'ZOMG, no external content found!!1!!1!!oneone!!!1!eleven!1!';
return $labels;
} );
/**
* Filter the meta key.
*
* @param string $meta_key Meta key.
*/
add_filter( 'external_content_meta_key', function() {
// Let's Shrekify the meta key
return 'far_far_away';
} );
/**
* Filter the post type.
*
* @param string $post_type Post type.
*/
add_filter( 'external_content_post_type', function() {
return 'exotic_stuff';
} );
/**
* Filter the post type supports.
*
* @param array $supports Post type supports.
*/
add_filter( 'external_content_supports', function( $supports ) {
// If your theme uses the excerpt for teasers, just remove the editor to prevent confusion
foreach ( $supports as $key => $value ) {
if ( 'editor' === $value ) {
unset( $supports[ $key ] );
}
}
return $supports;
} );
/**
* Filter the usage of the external URL as permalink.
*
* @param bool $use_external_url Use the external URL as permalink?
*/
add_filter( 'external_content_use_external_url', '__return_false' );
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.