function td_first_install_setup() { $td_isFirstInstall = td_util::get_option('firstInstall'); if (empty($td_isFirstInstall)) { td_util::update_option('firstInstall', 'themeInstalled'); wp_insert_term('Featured', 'category', array('description' => 'Featured posts', 'slug' => 'featured', 'parent' => 0)); // bulk enable all the theme thumbs! $td_theme_thumbs = td_api_thumb::get_all(); foreach ($td_theme_thumbs as $td_theme_thumb_id => $td_theme_thumb_params) { td_global::$td_options['tds_thumb_' . $td_theme_thumb_id] = 'yes'; } update_option(TD_THEME_OPTIONS_NAME, td_global::$td_options); // force an update of the options () } }
/** * get image - v 3.0 23 ian 2015 * @param $thumbType * @return string */ function get_image($thumbType) { $buffy = ''; //the output buffer $tds_hide_featured_image_placeholder = td_util::get_option('tds_hide_featured_image_placeholder'); /* * - if we have a post thumb - show that * - if we don't have a post thumb, check the image placeholder option and if we're also not a single page show the image placeholder. */ if ($this->post_has_thumb or $tds_hide_featured_image_placeholder != 'hide_placeholder') { if ($this->post_has_thumb) { //if we have a thumb // check to see if the thumb size is enabled in the panel, we don't have to check for the default wordpress thumbs (the default ones are already cut and we don't have a panel setting for them) if (td_util::get_option('tds_thumb_' . $thumbType) != 'yes' and $thumbType != 'thumbnail') { //the thumb is disabled, show a thumb from the theme with the thumb disabled message global $_wp_additional_image_sizes; if (empty($_wp_additional_image_sizes[$thumbType]['width'])) { $td_temp_image_url[1] = ''; } else { $td_temp_image_url[1] = $_wp_additional_image_sizes[$thumbType]['width']; } if (empty($_wp_additional_image_sizes[$thumbType]['height'])) { $td_temp_image_url[2] = ''; } else { $td_temp_image_url[2] = $_wp_additional_image_sizes[$thumbType]['height']; } $td_temp_image_url[0] = get_template_directory_uri() . '/images/thumb-disabled/' . $thumbType . '.png'; $attachment_alt = ''; $attachment_title = ''; } else { $attachment_id = get_post_thumbnail_id($this->post->ID); $td_temp_image_url = wp_get_attachment_image_src($attachment_id, $thumbType); $attachment_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); $attachment_alt = 'alt="' . esc_attr(strip_tags($attachment_alt)) . '"'; $attachment_title = ' title="' . esc_attr(strip_tags($this->title)) . '"'; if (empty($td_temp_image_url[0])) { $td_temp_image_url[0] = ''; } if (empty($td_temp_image_url[1])) { $td_temp_image_url[1] = ''; } if (empty($td_temp_image_url[2])) { $td_temp_image_url[2] = ''; } } // end panel thumb enabled check } else { //we have no thumb but the placeholder one is activated global $_wp_additional_image_sizes; if (empty($_wp_additional_image_sizes[$thumbType]['width'])) { $td_temp_image_url[1] = ''; } else { $td_temp_image_url[1] = $_wp_additional_image_sizes[$thumbType]['width']; } if (empty($_wp_additional_image_sizes[$thumbType]['height'])) { $td_temp_image_url[2] = ''; } else { $td_temp_image_url[2] = $_wp_additional_image_sizes[$thumbType]['height']; } $td_temp_image_url[0] = get_template_directory_uri() . '/images/no-thumb/' . $thumbType . '.png'; $attachment_alt = ''; $attachment_title = ''; } //end if ($this->post_has_thumb) { $buffy .= '<div class="td-module-thumb">'; if (current_user_can('edit_posts')) { $buffy .= '<a class="td-admin-edit" href="' . get_edit_post_link($this->post->ID) . '">edit</a>'; } $buffy .= '<a href="' . $this->href . '" rel="bookmark" title="' . $this->title_attribute . '">'; $buffy .= '<img width="' . $td_temp_image_url[1] . '" height="' . $td_temp_image_url[2] . '" itemprop="image" class="entry-thumb" src="' . $td_temp_image_url[0] . '" ' . $attachment_alt . $attachment_title . '/>'; // on videos add the play icon if (get_post_format($this->post->ID) == 'video') { $use_small_post_format_icon_size = false; // search in all the thumbs for the one that we are currently using here and see if it has post_format_icon_size = small foreach (td_api_thumb::get_all() as $thumb_from_thumb_list) { if ($thumb_from_thumb_list['name'] == $thumbType and $thumb_from_thumb_list['post_format_icon_size'] == 'small') { $use_small_post_format_icon_size = true; break; } } // load the small or medium play icon if ($use_small_post_format_icon_size === true) { $buffy .= '<span class="td-video-play-ico td-video-small"><img width="20" class="td-retina" src="' . get_template_directory_uri() . '/images/icons/video-small.png' . '" alt="video"/></span>'; } else { $buffy .= '<span class="td-video-play-ico"><img width="40" class="td-retina" src="' . get_template_directory_uri() . '/images/icons/ico-video-large.png' . '" alt="video"/></span>'; } } // end on video if $buffy .= '</a>'; $buffy .= '</div>'; //end wrapper return $buffy; } }
function td_init_booster() { global $content_width; // content width - this is overwritten in post if (!isset($content_width)) { $content_width = 640; } /* ---------------------------------------------------------------------------- * add_image_size for WordPress - register all the thumbs from the thumblist */ foreach (td_api_thumb::get_all() as $thumb_array) { if (td_util::get_option('tds_thumb_' . $thumb_array['name']) != '') { add_image_size($thumb_array['name'], $thumb_array['width'], $thumb_array['height'], $thumb_array['crop']); } } /* ---------------------------------------------------------------------------- * Add lazy shortcodes of the registered blocks */ foreach (td_api_block::get_all() as $block_settings_key => $block_settings_value) { td_global_blocks::add_lazy_shortcode($block_settings_key); } /* ---------------------------------------------------------------------------- * register the default sidebars + dynamic ones */ register_sidebar(array('name' => TD_THEME_NAME . ' default', 'id' => 'td-default', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>')); register_sidebar(array('name' => 'Footer 1', 'id' => 'td-footer-1', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>')); register_sidebar(array('name' => 'Footer 2', 'id' => 'td-footer-2', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>')); register_sidebar(array('name' => 'Footer 3', 'id' => 'td-footer-3', 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>')); //get our custom dynamic sidebars $currentSidebars = td_util::get_option('sidebars'); //if we have user made sidebars, register them in wp if (!empty($currentSidebars)) { foreach ($currentSidebars as $sidebar) { register_sidebar(array('name' => $sidebar, 'id' => 'td-' . td_util::sidebar_name_to_id($sidebar), 'before_widget' => '<aside class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<div class="block-title"><span>', 'after_title' => '</span></div>')); } //end foreach } $smooth_scroll = td_util::get_option('tds_smooth_scroll'); if (!empty($smooth_scroll)) { td_js_buffer::add_variable('tds_smooth_scroll', true); } }
* module_mega_menu * module_slide */ ?> <div class="td-box-row"> <div class="td-box-description td-box-full"> <span class="td-box-title">More information:</span> <p>From here you can enable the thumbnail image that will be cropped for the modules & blocks. If the thumbnail image is not enabled for a specific module that you use, the module will show a default placeholder with the size of the image and instructions about how to enable the thumb for that module</p> <p><strong style="color:red">Please regenerate your thumbnails if you change any of the thumb settings!</strong> - <a href="http://forum.tagdiv.com/existing-content/" target="_blank">read more</a></p> </div> <div class="td-box-row-margin-bottom"></div> </div> <?php foreach (td_api_thumb::get_all() as $thumb) { ?> <!-- THUMB --> <div class="td-box-row"> <div class="td-box-description"> <span class="td-box-title"><?php echo $thumb['width'] . ' x ' . $thumb['height']; ?> </span> </div> <div class="td-box-control-full"> <?php echo td_panel_generator::checkbox(array('ds' => 'td_option', 'option_id' => 'tds_thumb_' . $thumb['name'], 'true_value' => 'yes', 'false_value' => '')); ?> <div class="td-help-checkbox-inline"> <?php
/** * get image - v 3.0 23 ian 2015 * @param $thumbType * @return string */ function get_image($thumbType) { $buffy = ''; //the output buffer $tds_hide_featured_image_placeholder = td_util::get_option('tds_hide_featured_image_placeholder'); // do we have a post thumb or a placeholder? if (!is_null($this->post_thumb_id) or $tds_hide_featured_image_placeholder != 'hide_placeholder') { if (!is_null($this->post_thumb_id)) { //if we have a thumb // check to see if the thumb size is enabled in the panel, we don't have to check for the default wordpress // thumbs (the default ones are already cut and we don't have a panel setting for them) if (td_util::get_option('tds_thumb_' . $thumbType) != 'yes' and $thumbType != 'thumbnail') { //the thumb is disabled, show a placeholder thumb from the theme with the "thumb disabled" message global $_wp_additional_image_sizes; if (empty($_wp_additional_image_sizes[$thumbType]['width'])) { $td_temp_image_url[1] = ''; } else { $td_temp_image_url[1] = $_wp_additional_image_sizes[$thumbType]['width']; } if (empty($_wp_additional_image_sizes[$thumbType]['height'])) { $td_temp_image_url[2] = ''; } else { $td_temp_image_url[2] = $_wp_additional_image_sizes[$thumbType]['height']; } $td_temp_image_url[0] = get_template_directory_uri() . '/images/thumb-disabled/' . $thumbType . '.png'; $attachment_alt = 'alt=""'; $attachment_title = ''; } else { // the thumb is enabled from the panel, it's time to show the real thumb $td_temp_image_url = wp_get_attachment_image_src($this->post_thumb_id, $thumbType); $attachment_alt = get_post_meta($this->post_thumb_id, '_wp_attachment_image_alt', true); $attachment_alt = 'alt="' . esc_attr(strip_tags($attachment_alt)) . '"'; $attachment_title = ' title="' . esc_attr(strip_tags($this->title)) . '"'; if (empty($td_temp_image_url[0])) { $td_temp_image_url[0] = ''; } if (empty($td_temp_image_url[1])) { $td_temp_image_url[1] = ''; } if (empty($td_temp_image_url[2])) { $td_temp_image_url[2] = ''; } } // end panel thumb enabled check } else { //we have no thumb but the placeholder one is activated global $_wp_additional_image_sizes; if (empty($_wp_additional_image_sizes[$thumbType]['width'])) { $td_temp_image_url[1] = ''; } else { $td_temp_image_url[1] = $_wp_additional_image_sizes[$thumbType]['width']; } if (empty($_wp_additional_image_sizes[$thumbType]['height'])) { $td_temp_image_url[2] = ''; } else { $td_temp_image_url[2] = $_wp_additional_image_sizes[$thumbType]['height']; } $td_temp_image_url[0] = get_template_directory_uri() . '/images/no-thumb/' . $thumbType . '.png'; $attachment_alt = 'alt=""'; $attachment_title = ''; } //end if ($this->post_has_thumb) { $buffy .= '<div class="td-module-thumb">'; // if (current_user_can('edit_posts')) { // $buffy .= '<a class="td-admin-edit" href="' . get_edit_post_link($this->post->ID) . '">edit</a>'; // } // ZA Custom if (is_user_logged_in()) { if (wpfp_check_favorited($this->post->ID) === true) { $bookmark_link = '<a class="wpfp-link wpfp-style" href="?wpfpaction=remove&postid=' . $this->post->ID . '" title="Remove" rel="nofollow"><img class="icon-bookmark" src="/wp-content/uploads/2015/12/icon-bookmark-orange.png" alt=""><img class="icon-bookmark-hover" src="/wp-content/uploads/2015/11/icon-bookmark.png" alt=""></a>'; } else { $bookmark_link = '<a class="wpfp-link wpfp-style" href="?wpfpaction=add&postid=' . $this->post->ID . '" title="Bookmark" rel="nofollow"><img class="icon-bookmark" src="/wp-content/uploads/2015/11/icon-bookmark.png" alt=""><img class="icon-bookmark-hover" src="/wp-content/uploads/2015/11/icon-bookmark-added.png" alt=""></a>'; } } else { $bookmark_link = '<a class="wpfp-style register-dialog" href="http://rabbitworld.ready.co.th/?page_id=187" title="Bookmark" rel="nofollow"><img class="icon-bookmark" src="/wp-content/uploads/2015/11/icon-bookmark.png" alt=""><img class="icon-bookmark-hover" src="/wp-content/uploads/2015/11/icon-bookmark-added.png" alt=""></a>'; } $buffy .= $bookmark_link . '<a href="' . $this->href . '" rel="bookmark" title="' . $this->title_attribute . '">'; $buffy .= '<img width="' . $td_temp_image_url[1] . '" height="' . $td_temp_image_url[2] . '" itemprop="image" class="entry-thumb" src="' . $td_temp_image_url[0] . '" ' . $attachment_alt . $attachment_title . '/>'; // on videos add the play icon if (get_post_format($this->post->ID) == 'video') { $use_small_post_format_icon_size = false; // search in all the thumbs for the one that we are currently using here and see if it has post_format_icon_size = small foreach (td_api_thumb::get_all() as $thumb_from_thumb_list) { if ($thumb_from_thumb_list['name'] == $thumbType and $thumb_from_thumb_list['post_format_icon_size'] == 'small') { $use_small_post_format_icon_size = true; break; } } // load the small or medium play icon if ($use_small_post_format_icon_size === true) { $buffy .= '<span class="td-video-play-ico td-video-small"><img width="20" class="td-retina" src="' . get_template_directory_uri() . '/images/icons/video-small.png' . '" alt="video"/></span>'; } else { $buffy .= '<span class="td-video-play-ico"><img width="40" class="td-retina" src="' . get_template_directory_uri() . '/images/icons/ico-video-large.png' . '" alt="video"/></span>'; } } // end on video if $buffy .= '</a>'; $buffy .= '</div>'; //end wrapper return $buffy; } }