Skip to content

Instantly share code, notes, and snippets.

@svenl77
Created November 8, 2013 22:38
Show Gist options
  • Save svenl77/7378807 to your computer and use it in GitHub Desktop.
Save svenl77/7378807 to your computer and use it in GitHub Desktop.
function tk_loop_designer_options($template_name){
global $list_post_atts;
$loop_designer_options = get_option('tk_loop_designer_options');
$template_options = $loop_designer_options['template_options'];
//$template_name = isset($template_options[$template_name]['loop_template_name']) ? sanitize_title($template_options[$template_name]['loop_template_name']) : '';
$show_img = isset($template_options[$template_name]['loop_template_image_show']) ? $template_options[$template_name]['loop_template_image_show'] : '';
$img_position = isset($template_options[$template_name]['loop_template_image_position']) ? $template_options[$template_name]['loop_template_image_position'] : '';
$clickable = isset($template_options[$template_name]['loop_template_entry_clickable']) ? $template_options[$template_name]['loop_template_entry_clickable'] :'';
$list_post_template_entry_grid = isset($template_options[$template_name]['loop_template_entry_grid']) ? $template_options[$template_name]['loop_template_entry_grid'] : '';
$link_target = isset($template_options[$template_name]['loop_template_link_target']) ? $template_options[$template_name]['loop_template_link_target'] : '';
$show_more_link = isset($template_options[$template_name]['loop_template_read_more_link']) ? $template_options[$template_name]['loop_template_read_more_link'] : '';
$show_the_excerpt = isset($template_options[$template_name]['loop_template_content_show']) ? $template_options[$template_name]['loop_template_content_show'] : '';
$content_height = isset($template_options[$template_name]['loop_template_content_height']) ? $template_options[$template_name]['loop_template_content_height'] : '';
// sets the image width and height if there's a value.
// if no value set, it becomes a 9999 = adapt the size automatically.
if ( !empty($template_options[$template_name]['loop_template_image_height'])) {
$featured_posts_image_height = $template_options[$template_name]['loop_template_image_height'];
} else {
$featured_posts_image_height = 9999;
}
if (!empty($template_options[$template_name]['loop_template_image_width']) ) {
$featured_posts_image_width = $template_options[$template_name]['loop_template_image_width'];
} else {
$featured_posts_image_width = 9999;
}
$list_post_atts = array(
'show_img' => $show_img,
'template_name' => $template_name,
'img_position' => $img_position,
// 'height' => $height,
// 'featured_id' => $featured_id,
'featured_posts_image_width' => $featured_posts_image_width,
'featured_posts_image_height' => $featured_posts_image_height,
// 'margintop' => $margintop,
'link_target' => $link_target,
'show_the_excerpt' => $show_the_excerpt,
'show_more_link' => $show_more_link,
'arrayindex' => $template_name,
'clickable' => $clickable,
'list_post_template_entry_grid' => $list_post_template_entry_grid,
'content_height' => $content_height,
);
// echo '<pre>';
// print_r($list_post_atts);
// echo '</pre>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment