Skip to content

Instantly share code, notes, and snippets.

@icreatesolutions
Created December 8, 2015 22:46
Show Gist options
  • Save icreatesolutions/1c680f5bffe9eb1a2bc7 to your computer and use it in GitHub Desktop.
Save icreatesolutions/1c680f5bffe9eb1a2bc7 to your computer and use it in GitHub Desktop.
Functions for associating a soliloquy slider with a post
<?php
// Display Soliloquy Slider metabox on custom post type
add_filter( 'soliloquy_skipped_posttypes', 'icreate_soliloquy_skipped_posttypes' );
function icreate_soliloquy_skipped_posttypes( $post_types ) {
unset( $post_types['custom_type_slug'] );
return $post_types;
}
// Set slider dimensions
add_filter( 'soliloquy_defaults', 'icreate_soliloquy_default_settings', 20, 2 );
function icreate_soliloquy_default_settings( $defaults, $post_id ) {
$defaults['slider_width'] = 940; // Slider width.
$defaults['slider_height'] = 435; // Slider height.
return $defaults;
}
// Display the slider in your post
if ( get_post_meta( get_the_ID(), '_sol_in_slider', true ) != '' ) {
soliloquy( get_the_ID() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment