Automatic sreenshot $post_content .= "<img src='http://s.wordpress.com/mshots/v1/" . esc_url( $bookmark['uri'] ) . "' />";
cheers
Description works fine
// Get meta description
function getDescription($url) {
$tags = get_meta_tags($url);
return @($tags['description'] ? $tags['description'] : "NULL");
}
// Post meta description.
$post_content .= 'Meta Description: ' . getDescription( $bookmark['uri'] );
Next I will look at the source code of the Firefox addon Free Export Bookmarks
Not sure if you’re directly editing the plugin’s files (you probably shouldn’t), but you should be able to edit post_content
using the available filters.
Example:
add_filter( 'import_bookmarks_post_content', function( $post_content, $bookmark ) {
$post_content .= "<img src='http://s.wordpress.com/mshots/v1/" . esc_url( $bookmark['uri'] ) . "'>";
return $post_content;
}, 10, 2 );
Some more inspiration can be found at https://jan.boddez.net/wordpress/import-bookmarks.
For redirects (definitely out of scope for the plugin itself), if you mean rather than show the generated post you would want to immediately redirect visitors to the bookmarked URL, you’re going to want to hook into a much earlier WP hook, one that runs before any headers are outputted.
Note that you could always fetch the stored URL like so (at least if your chosen Post Type supports custom meta fields): get_post_meta( $post_id, 'import_bookmarks_uri', true );
and (probably) grab $post_id
from a query var or the post
global.
But, like I said, that would be an add-on plugin on its own.
-
This reply was modified 3 years, 9 months ago by
Jan Boddez.
-
This reply was modified 3 years, 9 months ago by
Jan Boddez.