• Resolved tobylewis

    (@tobylewis)


    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]

    https://www.ads-software.com/extend/plugins/flickr-shortcode-importer/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter tobylewis

    (@tobylewis)

    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' );

    Plugin Author Michael Cannon

    (@comprock)

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

    It’ll speed up implementing the changes for 1.7.9.

    Thread Starter tobylewis

    (@tobylewis)

    Hi Michael

    Here are the various edits in one pastebin

    https://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

    Plugin Author Michael Cannon

    (@comprock)

    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 https://typo3vagabond.com/contact-typo3vagabond/.

    Ciao!

    Michael

    Thread Starter tobylewis

    (@tobylewis)

    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

    Plugin Author Michael Cannon

    (@comprock)

    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Flickr Shortcode Importer] Support for custom post types’ is closed to new replies.