WordPress.org

Ready to get started?Download WordPress

Forums

Flickr Shortcode Importer by Aihrus
[resolved] [Plugin: Flickr Shortcode Importer] Support for custom post types (7 posts)

  1. tobylewis
    Member
    Posted 2 years ago #

    The plugin only supports short codes on the Post and Page post types. These days themes often come with other post types which need to be processed (I'm using one which has "portfolio" post types which are precisely where the [flickr] codes are going to be.

    Below are the edits which add options to the Post Options tab of settings and extend the plugin functions to operate on any of the selected post types.

    first the code for the settings page

    [ Code edited and moderator note: please use backticks or the code button when posting small code snippets of 10 lines or less. ]

    $posttypes = (array) get_post_types( array('public'=>TRUE), 'objects' );
    		foreach($posttypes AS $ptype=>$ptype_obj)
    		{
    			$this->settings['ptype_enable_post_widget_'.$ptype] = array(
    				'section' => 'posts',
    				'title'   => __( 'Process shortcodes on' , 'flickr-shortcode-importer'),
    				'desc'    => __( $ptype_obj->labels->name.' type of post.' , 'flickr-shortcode-importer'),
    				'type'    => 'checkbox',
    				'std'     => 1 // Set to 1 to be checked by default, 0 to be unchecked by default.
    			);
    		}

    and now the code for the main plugin file

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    http://wordpress.org/extend/plugins/flickr-shortcode-importer/

  2. tobylewis
    Member
    Posted 2 years ago #

    One more thing. It would be nice to be able to set the options in the [gallery] shortcode to replace the [flickr] shortcode. Therefore this will add an option to the settings so it can be specified

    [ Moderator note: See above note about code formatting. ]

    $this->settings['default_gallery_markup'] = array(
    			'title'   => __( 'Default Gallery Markup' , 'flickr-shortcode-importer'),
    			'desc'    => __( 'The shortcode and parameters to replace [flickr] etc with.' , 'flickr-shortcode-importer'),
    			'std'     => '[gallery link="file"]',
    			'type'    => 'text',
    			'section' => 'general'
    		);

    and then in shortcode_flickrset( ) and shortcode_flickr_gallery( )
    change the $markup assignment to:

    $markup = fsi_get_options( 'default_gallery_markup' );
  3. Michael Cannon
    Member
    Plugin Author

    Posted 2 years ago #

    Can you send your code suggestions to Pastebin for me to review further?

    It'll speed up implementing the changes for 1.7.9.

  4. tobylewis
    Member
    Posted 2 years ago #

    Hi Michael

    Here are the various edits in one pastebin

    http://pastebin.com/5JM2wAGX

    Basically they are all whole functions except for a modification of the query in the middle of function user_interface() and the two snippets that go into the settings page.

    I guess you will have to test if the curl functions exist and then choose to do the curl or file_get_contents() methods.

    HTH

    ~Toby

  5. Michael Cannon
    Member
    Plugin Author

    Posted 2 years ago #

    Toby,

    Could you please send me the FSI plugin zipped up?

    I'd like to diff it against my latest trunk to make updating easier.

    Send the file via http://typo3vagabond.com/contact-typo3vagabond/.

    Ciao!

    Michael

  6. tobylewis
    Member
    Posted 2 years ago #

    Hi Micheal
    I tried using the form but it says "that file type is not allowed" was sending a .zip
    Download it here
    https://dl.dropbox.com/u/8839941/flickr-shortcode-importer.zip
    ~Toby

  7. Michael Cannon
    Member
    Plugin Author

    Posted 2 years ago #

    Latest release supports custom post types now.

    You might need to double-check your settings under Posts to ensure your custom types are checked though.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.