Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save calliaweb/8886080 to your computer and use it in GitHub Desktop.

Select an option

Save calliaweb/8886080 to your computer and use it in GitHub Desktop.

Revisions

  1. calliaweb revised this gist May 7, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@

    add_filter( 'soliloquy_output_single_item', 'jmw_soliloquy_add_custom_slides', 10, 5 );
    /**
    * Filter the slide html to append another slide.
    * Filter the Soliloquy slide html to append another slide. Works with version 2 of Soliloquy.
    *
    * @link http://soliloquywp.com/docs/appending-custom-slides-to-your-slider/
    *
  2. calliaweb revised this gist May 7, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@
    *
    * @return string Amended slider HTML.
    */
    function jmw_soliloquy_add_custom_slides( $slider_html, $slider_id, $image, $$dataa, s$lide_id ) {
    function jmw_soliloquy_add_custom_slides( $slider_html, $slider_id, $image, $data, $slide_id ) {

    // Bail out early if we are not targeting our specific slider. Remove this if you want it to apply to all sliders.
    if ( 2843 !== $data['id']) {
  3. calliaweb revised this gist May 7, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@
    *
    * @return string Amended slider HTML.
    */
    function jmw_soliloquy_add_custom_slides( $slider_html, $slider_id, $image, $$ata, s$lide_id ) {
    function jmw_soliloquy_add_custom_slides( $slider_html, $slider_id, $image, $$dataa, s$lide_id ) {

    // Bail out early if we are not targeting our specific slider. Remove this if you want it to apply to all sliders.
    if ( 2843 !== $data['id']) {
  4. calliaweb revised this gist May 7, 2014. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    <?php
    // Do NOT include the opening php tag above

    add_filter( 'tgmsp_individual_slide', 'jmw_soliloquy_add_custom_slides', 10, 4 );
    add_filter( 'soliloquy_output_single_item', 'jmw_soliloquy_add_custom_slides', 10, 5 );
    /**
    * Filter the slide html to append another slide.
    *
    @@ -10,14 +10,15 @@
    * @param string $slider_html Existing slide HTML.
    * @param string $slider_id ID of the slider.
    * @param array $image Array of slide image details.
    * @param array $data Array of slider config data.
    * @param integer $slide_id ID of the slide.
    *
    * @return string Amended slider HTML.
    */
    function jmw_soliloquy_add_custom_slides( $slider_html, $slider_id, $image, $slide_id ) {
    function jmw_soliloquy_add_custom_slides( $slider_html, $slider_id, $image, $$ata, s$lide_id ) {

    // Bail out early if we are not targeting our specific slider. Remove this if you want it to apply to all sliders.
    if ( '2843' !== $slider_id ) {
    if ( 2843 !== $data['id']) {
    return $slider_html;
    }

  5. calliaweb revised this gist Feb 9, 2014. 1 changed file with 40 additions and 46 deletions.
    86 changes: 40 additions & 46 deletions add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -1,55 +1,49 @@
    <?php
    //* Do NOT include the opening php tag

    // Add additional pages to the featured content slider
    // Original reference http://soliloquywp.com/docs/appending-custom-slides-to-your-slider/
    // Do NOT include the opening php tag above

    add_filter( 'tgmsp_individual_slide', 'jmw_soliloquy_add_custom_slides', 10, 4 );

    /*
    * Filters the slide html to append another slide.
    *
    * @param string $slider Existing slide html
    * @param string $id ID of the slider
    * @param array $image Array of slide image details
    * @param integer $i ID of the slide
    */
    function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {

    global $soliloquy_data;
    /**
    * Filter the slide html to append another slide.
    *
    * @link http://soliloquywp.com/docs/appending-custom-slides-to-your-slider/
    *
    * @param string $slider_html Existing slide HTML.
    * @param string $slider_id ID of the slider.
    * @param array $image Array of slide image details.
    * @param integer $slide_id ID of the slide.
    *
    * @return string Amended slider HTML.
    */
    function jmw_soliloquy_add_custom_slides( $slider_html, $slider_id, $image, $slide_id ) {

    // Bail out early if we are not targeting our specific slider. Remove this if you want it to apply to all sliders.
    if ( '2843' !== $id )
    return $slider;
    if ( '2843' !== $slider_id ) {
    return $slider_html;
    }

    if ( $i == 1 ) // Add a slide after first post slide
    $add_slide_html = jmw_soliloquy_generate_slide_html( '2763' ); // generates the slide html using the page with id 2763

    if ($i == 2 ) // Add a slide after second post slide
    $add_slide_html = jmw_soliloquy_generate_slide_html( '2769' ); // generates the slide html using the page with id 2769

    // Append our additional slide HTML to the original $slider HTML
    $slider .= $add_slide_html;

    if ( 1 == $slide_id ) { // Add a slide after first post slide
    $slider_html .= jmw_soliloquy_generate_slide_html( '2763' );
    } elseif ( 2 == $slide_id ) { // Add a slide after second post slide
    $slider_html .= jmw_soliloquy_generate_slide_html( '2769' );
    }

    // Return the amended slider HTML with our custom slides.
    return $slider;
    return $slider_html;
    }

    /*
    * Generates slide html string for given page id
    *
    * @param string $ss_page_id The featured page id to generate the slide from
    * @returns string $add_slide_html The html string for the slide
    *
    */
    function jmw_soliloquy_generate_slide_html( $ss_page_id ) {

    $add_slide_html = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id($ss_page_id) ) ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id )

    /**
    * Generate slide html string for given page id.
    *
    * @param string $page_id The Page ID to generate the slide from.
    *
    * @return string The HTML string for the slide.
    */
    function jmw_soliloquy_generate_slide_html( $page_id ) {
    return sprintf(
    '<li class="soliloquy-item"><a href="%1$s"><img class="soliloquy-item-image" src="%2$s" title="%3$s" alt="%3$s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%4$s</h2></div></div></li>',
    esc_url( get_permalink( $page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id( $page_id ) ) ),
    esc_attr( get_the_title( $page_id ) ),
    get_the_title( $page_id )
    );

    return $add_slide_html;
    }
  6. calliaweb revised this gist Feb 8, 2014. 1 changed file with 6 additions and 9 deletions.
    15 changes: 6 additions & 9 deletions add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    add_filter( 'tgmsp_individual_slide', 'jmw_soliloquy_add_custom_slides', 10, 4 );

    /*
    * Filters the slide html to append another slide
    * Filters the slide html to append another slide.
    *
    * @param string $slider Existing slide html
    * @param string $id ID of the slider
    @@ -21,20 +21,17 @@ function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {
    if ( '2843' !== $id )
    return $slider;

    if ( $i == 1 ) { // Add a slide after first post slide
    if ( $i == 1 ) // Add a slide after first post slide
    $add_slide_html = jmw_soliloquy_generate_slide_html( '2763' ); // generates the slide html using the page with id 2763
    }

    if ($i == 2 ) { // Add a slide after second post slide

    if ($i == 2 ) // Add a slide after second post slide
    $add_slide_html = jmw_soliloquy_generate_slide_html( '2769' ); // generates the slide html using the page with id 2769
    }


    // Append our additional slide HTML to the original $slider HTML
    $slider .= $add_slide_html;

    // Return the amended slider HTML with our custom slides.
    return $slider;

    }

    /*
  7. calliaweb revised this gist Feb 8, 2014. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    // Add additional pages to the featured content slider
    // Original reference http://soliloquywp.com/docs/appending-custom-slides-to-your-slider/
    add_filter( 'tgmsp_individual_slide', 'jmw_soliloquy_add_custom_slides', 10, 4 );
    function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {

    /*
    * Filters the slide html to append another slide
    *
    @@ -13,6 +13,8 @@ function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {
    * @param array $image Array of slide image details
    * @param integer $i ID of the slide
    */
    function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {

    global $soliloquy_data;

    // Bail out early if we are not targeting our specific slider. Remove this if you want it to apply to all sliders.
    @@ -35,14 +37,15 @@ function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {

    }

    function jmw_soliloquy_generate_slide_html( $ss_page_id ) {
    /*
    * Generates slide html string for given page id
    *
    * @param string $ss_page_id The featured page id to generate the slide from
    * @returns string $add_slide_html The html string for the slide
    *
    */
    function jmw_soliloquy_generate_slide_html( $ss_page_id ) {

    $add_slide_html = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id($ss_page_id) ) ),
  8. calliaweb revised this gist Feb 8, 2014. 1 changed file with 9 additions and 10 deletions.
    19 changes: 9 additions & 10 deletions add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -15,23 +15,23 @@ function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {
    */
    global $soliloquy_data;

    // Bail out early if we are not targeting our specific slider. Remove this if you want it to apply to all sliders.
    if ( '2843' !== $id )
    return $slider;
    // Bail out early if we are not targeting our specific slider. Remove this if you want it to apply to all sliders.
    if ( '2843' !== $id )
    return $slider;

    if ( $i == 1 ) { // Add a slide after first post slide
    if ( $i == 1 ) { // Add a slide after first post slide
    $add_slide_html = jmw_soliloquy_generate_slide_html( '2763' ); // generates the slide html using the page with id 2763
    }

    if ($i == 2 ) { // Add a slide after second post slide
    $add_slide_html = jmw_soliloquy_generate_slide_html( '2769' ); // generates the slide html using the page with id 2769
    }
    $add_slide_html = jmw_soliloquy_generate_slide_html( '2769' ); // generates the slide html using the page with id 2769
    }

    // Append our additional slide HTML to the original $slider HTML
    $slider .= $add_slide_html;
    $slider .= $add_slide_html;

    // Return the amended slider HTML with our custom slides.
    return $slider;
    // Return the amended slider HTML with our custom slides.
    return $slider;

    }

    @@ -43,7 +43,6 @@ function jmw_soliloquy_generate_slide_html( $ss_page_id ) {
    * @returns string $add_slide_html The html string for the slide
    *
    */

    $add_slide_html = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id($ss_page_id) ) ),
  9. calliaweb revised this gist Feb 8, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -10,8 +10,8 @@ function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {
    *
    * @param string $slider Existing slide html
    * @param string $id ID of the slider
    * @param string $image
    * @param string $i ID of the slide
    * @param array $image Array of slide image details
    * @param integer $i ID of the slide
    */
    global $soliloquy_data;

  10. calliaweb revised this gist Feb 8, 2014. 1 changed file with 42 additions and 30 deletions.
    72 changes: 42 additions & 30 deletions add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -5,40 +5,52 @@
    // Original reference http://soliloquywp.com/docs/appending-custom-slides-to-your-slider/
    add_filter( 'tgmsp_individual_slide', 'jmw_soliloquy_add_custom_slides', 10, 4 );
    function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {
    /*
    * Filters the slide html to append another slide
    *
    * @param string $slider Existing slide html
    * @param string $id ID of the slider
    * @param string $image
    * @param string $i ID of the slide
    */
    global $soliloquy_data;

    global $soliloquy_data;

    // Bail out early if we are not targeting our specific slider. Remove this if you want it to apply to all sliders.
    if ( '2843' !== $id )
    return $slider;

    // Add a slide after first post slide
    if ( 1 == $i ) {
    $ss_page_id = 2763; // Page ID of Page you want to insert
    $add_slider = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id( $ss_page_id ) ) ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id )
    );
    }
    // Bail out early if we are not targeting our specific slider. Remove this if you want it to apply to all sliders.
    if ( '2843' !== $id )
    return $slider;

    // Add a slide after second post slide
    if ( 2 == $i ) {
    $ss_page_id = 2769; // Page ID of Page you want to insert
    $add_slider = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id( $ss_page_id ) ) ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id )
    );
    if ( $i == 1 ) { // Add a slide after first post slide
    $add_slide_html = jmw_soliloquy_generate_slide_html( '2763' ); // generates the slide html using the page with id 2763
    }

    if ($i == 2 ) { // Add a slide after second post slide
    $add_slide_html = jmw_soliloquy_generate_slide_html( '2769' ); // generates the slide html using the page with id 2769
    }

    // Append our additional slide HTML to the original $slider HTML
    $slider .= $add_slider;
    $slider .= $add_slide_html;

    // Return the amended slider HTML with our custom slides.
    return $slider;
    // Return the amended slider HTML with our custom slides.
    return $slider;

    }

    function jmw_soliloquy_generate_slide_html( $ss_page_id ) {
    /*
    * Generates slide html string for given page id
    *
    * @param string $ss_page_id The featured page id to generate the slide from
    * @returns string $add_slide_html The html string for the slide
    *
    */

    $add_slide_html = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id($ss_page_id) ) ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id )
    );

    return $add_slide_html;
    }
  11. calliaweb revised this gist Feb 8, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {
    $ss_page_id = 2763; // Page ID of Page you want to insert
    $add_slider = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id($ss_page_id) ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id( $ss_page_id ) ) ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id )
    @@ -29,7 +29,7 @@ function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {
    $ss_page_id = 2769; // Page ID of Page you want to insert
    $add_slider = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id($ss_page_id) ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id( $ss_page_id ) ) ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id )
  12. calliaweb revised this gist Feb 8, 2014. 1 changed file with 10 additions and 8 deletions.
    18 changes: 10 additions & 8 deletions add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,13 @@
    <?php
    //* Do NOT include the opening php tag

    // Add additional pages to the featured content slider
    // Original reference http://soliloquywp.com/docs/appending-custom-slides-to-your-slider/
    add_filter( 'tgmsp_individual_slide', 'jmw_soliloquy_add_custom_slides', 10, 4 );
    function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {

    global $soliloquy_data;

    // Bail out early if we are not targeting our specific slider. Remove this if you want it to apply to all sliders.
    if ( '2843' !== $id )
    return $slider;
    @@ -23,20 +26,19 @@ function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {

    // Add a slide after second post slide
    if ( 2 == $i ) {
    $ss_page_id = 2769; // Page ID of Page you want to insert
    $add_slider = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    $ss_page_id = 2769; // Page ID of Page you want to insert
    $add_slider = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id($ss_page_id) ) ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id )
    );
    }
    }

    // Append our additional slide HTML to the original $slider HTML
    $slider .= $add_slider;

    // Return the amended slider HTML with our custom slides.
    return $slider;

    // Return the amended slider HTML with our custom slides.
    return $slider;
    }
  13. calliaweb revised this gist Feb 8, 2014. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions add-pages-to-soliloquy-featured-content-slider.php
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,3 @@
    <?php
    //* Do NOT include the opening php tag

    // Add additional pages to the featured content slider
    // Original reference http://soliloquywp.com/docs/appending-custom-slides-to-your-slider/
    add_filter( 'tgmsp_individual_slide', 'jmw_soliloquy_add_custom_slides', 10, 4 );
  14. calliaweb renamed this gist Feb 8, 2014. 1 changed file with 0 additions and 0 deletions.
  15. calliaweb revised this gist Feb 8, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Add pages to Soliloquy featured content slider
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    <?php
    //* Do NOT include the opening php tag

    // Add additional pages to the featured content slider
    // Original reference http://soliloquywp.com/docs/appending-custom-slides-to-your-slider/
    add_filter( 'tgmsp_individual_slide', 'jmw_soliloquy_add_custom_slides', 10, 4 );
  16. calliaweb revised this gist Feb 8, 2014. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions Add pages to Soliloquy featured content slider
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,3 @@
    <?php
    //* Do NOT include the opening php tag

    // Add additional pages to the featured content slider
    // Original reference http://soliloquywp.com/docs/appending-custom-slides-to-your-slider/
    add_filter( 'tgmsp_individual_slide', 'jmw_soliloquy_add_custom_slides', 10, 4 );
  17. calliaweb created this gist Feb 8, 2014.
    45 changes: 45 additions & 0 deletions Add pages to Soliloquy featured content slider
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    <?php
    //* Do NOT include the opening php tag

    // Add additional pages to the featured content slider
    // Original reference http://soliloquywp.com/docs/appending-custom-slides-to-your-slider/
    add_filter( 'tgmsp_individual_slide', 'jmw_soliloquy_add_custom_slides', 10, 4 );
    function jmw_soliloquy_add_custom_slides( $slider, $id, $image, $i ) {

    global $soliloquy_data;

    // Bail out early if we are not targeting our specific slider. Remove this if you want it to apply to all sliders.
    if ( '2843' !== $id )
    return $slider;

    // Add a slide after first post slide
    if ( 1 == $i ) {
    $ss_page_id = 2763; // Page ID of Page you want to insert
    $add_slider = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id($ss_page_id) ) ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id )
    );
    }

    // Add a slide after second post slide
    if ( 2 == $i ) {
    $ss_page_id = 2769; // Page ID of Page you want to insert
    $add_slider = sprintf('<li class="soliloquy-item"><a href="%s"><img class="soliloquy-item-image" src="%s" title="%s" alt="%s" /></a><div class="soliloquy-caption"><div class="soliloquy-caption-inside soliloquy-fc-caption"><h2 class="soliloquy-fc-title">%s</h2></div></div></li>',
    esc_url( get_permalink( $ss_page_id ) ),
    esc_url( wp_get_attachment_url( get_post_thumbnail_id($ss_page_id) ) ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id ),
    get_the_title( $ss_page_id )
    );
    }

    // Append our additional slide HTML to the original $slider HTML
    $slider .= $add_slider;

    // Return the amended slider HTML with our custom slides.
    return $slider;

    }