Override Create Gallery Page Content

FooGallery Documentation

Override Create Gallery Page Content

FooGallery comes with a nifty feature to quickly create a page with which includes the gallery shortcode in a single click. Once you have published a gallery, look for the Gallery Usage metabox on the top right. If the gallery is not included in any pages or posts, then click the Create Gallery Page button. This will create a draft page with the page title set to the gallery title, and the page content will be the shortcode for the gallery.

Override The Page Content

By default, the page content will only contain the gallery shortcode, but you can override this content by adding some custom code to your site.

It is done by using the filter called foogallery_create_gallery_page_content.

The below example code shows you how to change the content:

function custom_foogallery_page_content( $content, $foogallery ) {
  return '<h2>Gallery : ' . $foogallery->name . '</h2>' . $content;

add_filter( 'foogallery_create_gallery_page_content', 'custom_foogallery_page_content', 10, 2 );Code language: PHP (php)