Return to Snippet

Revision: 58898
at August 9, 2012 03:25 by Jamie


Updated Code
/**
 * Hook-in to slidedeck_after_get filter
 * 
 * @return array
 */
function slidedeck_after_get( $slidedeck ) {
    global $SlideDeckPlugin;
    /**
    * For this example, I'm fetching the twitter handle from the request URI, but
    * you could get this from custom post meta or another source too.
    */
    $twitter_handle = (string) $_REQUEST['twitter_handle'];
	
    // Specify the SlideDeck ID or this will affect all decks!
    if( $slidedeck['id'] == 48842 ) {
    	$slidedeck['options']['twitter_username'] = $twitter_handle;
    }
    
    return $slidedeck;
}
add_action( 'slidedeck_after_get', 'slidedeck_after_get' );

Revision: 58897
at August 9, 2012 03:14 by Jamie


Updated Code
/**
 * Hook-in to slidedeck_after_get filter
 * 
 * @return array
 */
function slidedeck_after_get( $slidedeck ) {
    global $SlideDeckPlugin;
	/**
	 * For this example, I'm fetching the twitter handle from the request URI, but
	 * you could get this from custom post meta or another source too.
	 */
	$twitter_handle = (string) $_REQUEST['twitter_handle'];
	
	// Specify the SlideDeck ID or this will affect all decks!
    if( $slidedeck['id'] == 48842 ) {
    	$slidedeck['options']['twitter_username'] = $twitter_handle;
    }
    
    return $slidedeck;
}
add_action( 'slidedeck_after_get', 'slidedeck_after_get' );

Revision: 58896
at August 9, 2012 03:13 by Jamie


Initial Code
/**
 * Hook-in to slidedeck_after_get filter
 * 
 * Modifies SlideDeck according to live demo parameters
 * 
 * @return array
 */
function slidedeck_after_get( $slidedeck ) {
    global $SlideDeckPlugin;
	/**
	 * For this example, I'm fetching the twitter handle from the request URI, but
	 * you could get this from custom post meta or another source too.
	 */
	$twitter_handle = (string) $_REQUEST['twitter_handle'];
	
	// Specify the SlideDeck ID or this will affect all decks!
    if( $slidedeck['id'] == 48842 ) {
    	$slidedeck['options']['twitter_username'] = $twitter_handle;
    }
    
    return $slidedeck;
}
add_action( 'slidedeck_after_get', 'slidedeck_after_get' );

Initial URL

                                

Initial Description
Allows a SlideDeck user to hook into the options array after the SlideDeck is fetched from the database. Options can then be modified based on the request.

Initial Title
SlideDeck 2 After get hook-in for overriding deck options

Initial Tags

                                

Initial Language
PHP