how to add html code to functions.php
-
Hello
How to add html code into functions.php for thumbnail images
Tooltip <span> <img class=”callout” src=”src/callout_black.gif” /> Most Light-weight Tooltip This is the easy-to-use Tooltip driven purely by CSS. </span> <img src=”../img/demo/css-tooltip-image.gif” /> <span> <img class=”callout” src=”src/callout_black.gif” /> CSS only Tooltip <img src=”../img/demo/css-tooltip-image.gif” style=”float:right;” /> Pure CSS popup tooltips with clean semantic XHTML. </span>
My site https://www.retete-super.ro
Functions.php code
if (!function_exists(‘theme_get_post_thumbnail’)){
function theme_get_post_thumbnail($args = array()){
global $post;
$size = theme_get_array_value($args, ‘size’, array(theme_get_option(‘theme_metadata_thumbnail_width’), theme_get_option(‘theme_metadata_thumbnail_height’)));
$auto = theme_get_array_value($args, ‘auto’, theme_get_option(‘theme_metadata_thumbnail_auto’));
$featured = theme_get_array_value($args, ‘featured’, theme_get_option(‘theme_metadata_use_featured_image_as_thumbnail’));
$title = theme_get_array_value($args, ‘title’, get_the_title());
$result = ”;
if ($featured && (function_exists(‘has_post_thumbnail’)) && (has_post_thumbnail())) {
ob_start();
the_post_thumbnail($size, array(‘alt’ => ”, ‘title’ => $title));
$result = ob_get_clean();
} elseif ($auto) {
$attachments = get_children(array(‘post_parent’ => $post->ID, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order ID’));
if($attachments) {
$attachment = array_shift($attachments);
$img = wp_get_attachment_image_src($attachment->ID, $size);
if (isset($img[0])) {
$result = ‘<img src=”‘.$img[0].'” alt=”” width=”‘.$img[1].'” height=”‘.$img[2].'” title=”‘.$title.'” class=”wp-post-image” />’;
}
}
}
Thank you
- The topic ‘how to add html code to functions.php’ is closed to new replies.