Insert [gallery] shortcode on form

This topic contains 5 reply and 3 voices, and was last updated by Gaby 9 years, 10 months ago
Viewing 5 Posts - 1 through 5 (of 5 total)
Author Posts
April 27, 2013 at 12:53 am 2923
Gaby I would like to insert the gallery shortcode to show images of post. The problem is that  I need insert the shortcode automatically, without user typing. Thanks
April 27, 2013 at 7:16 am 2928
Tareq Hasan Tareq Hasan

Inserting this snippet to your theme functions.php will append the gallery shortcode to your posts automatically when creating a new post.

[php]
function wpufe_append_gallery( $postarr ) {
$postarr[‘post_content’] .= "[gallery]";

return $postarr;
}

add_filter( ‘wpuf_add_post_args’, ‘wpufe_append_gallery’ );
[/php]

April 29, 2013 at 12:41 pm 2981
ggsalas ggsalas

Works perfect. Thanks

June 24, 2013 at 3:41 pm 5156
ggsalas ggsalas

Can I insert the “gallery” shortcode ONLY on the posts with gallery format?

Thanks

June 24, 2013 at 7:56 pm 5170
Tareq Hasan Tareq Hasan

The existing code can be modified like this:

[php]
function wpufe_append_gallery( $postarr, $form_id, $settings ) {
if ( $settings[‘post_format’] == ‘gallery’ ) {
$postarr[‘post_content’] .= "[gallery]";
}

return $postarr;
}

add_filter( ‘wpuf_add_post_args’, ‘wpufe_append_gallery’, 10, 3 );
[/php]

January 9, 2015 at 9:18 pm 33746
Gaby Gaby

How would I put the images in to a slider?

Viewing 5 Posts - 1 through 5 (of 5 total)