Ejemplo n.º 1
0
/**
 * Dislays custom logo on Login Page
 *
 * @uses $rtp_general array
 *
 * @since rtPanel 2.0
 */
function rtp_custom_login_logo()
{
    global $rtp_general;
    $custom_logo = $rtp_general['logo_upload'];
    if (isset($rtp_general['logo_width']) && !empty($rtp_general['logo_width']) && isset($rtp_general['logo_height']) && !empty($rtp_general['logo_height'])) {
        $rtp_logo_width = $rtp_general['logo_width'];
        $rtp_logo_height = $rtp_general['logo_height'];
    } else {
        $dimensions = rtp_get_image_dimensions($custom_logo, true);
        if (isset($dimensions['width']) && isset($dimensions['height'])) {
            $rtp_logo_width = $dimensions['width'];
            $rtp_logo_height = $dimensions['height'];
        } else {
            $rtp_logo_width = $rtp_logo_height = 0;
        }
    }
    $rtp_wp_loginbox_width = 312;
    if ($rtp_logo_width > $rtp_wp_loginbox_width) {
        $ratio = $rtp_logo_height / $rtp_logo_width;
        $rtp_logo_height = ceil($ratio * $rtp_wp_loginbox_width);
        $rtp_logo_width = $rtp_wp_loginbox_width;
        $rtp_background_size = 'contain';
    } else {
        $rtp_background_size = 'auto';
    }
    echo '<style type="text/css">
        .login h1 { margin-left: 8px; }
        .login h1 a { background: url( ' . $custom_logo . ' ) no-repeat 50% 0;
                background-size: ' . $rtp_background_size . ';';
    if ($rtp_logo_width && $rtp_logo_height) {
        echo 'height: ' . $rtp_logo_height . 'px;
              width: ' . $rtp_logo_width . 'px; margin: 0 auto 15px; padding: 0; }';
    }
    echo '</style>';
}
Ejemplo n.º 2
0
/**
 * Displays Attachment Image Thumbnail
 *
 * @since rtPanel 2.0
 * @param Integer $post_id for which post thumbnail will be fetched
 * @param String $thumbnail_size size of the thumbnail required. Default is thumbnail
 * @param String $default_img_path The path to the default image ( in case of no thumbnail found )
 */
function rtp_show_post_thumbnail($post_id = null, $thumbnail_size = 'thumbnail', $default_img_path = '')
{
    global $rtp_post_comments;
    if (!is_singular() && $rtp_post_comments['summary_show'] && $rtp_post_comments['thumbnail_show'] && !rtp_is_bbPress()) {
        $thumbnail_frame = $rtp_post_comments['thumbnail_frame'] ? 'rtp-thumbnail-shadow' : 'rtp-no-thumbnail-shadow';
        $image_align = 'align' . strtolower($rtp_post_comments['thumbnail_position']);
        if (has_post_thumbnail()) {
            echo '<figure class="rtp-thumbnail-container ' . esc_attr($image_align) . ' ' . $thumbnail_frame . '">';
            ?>
			<a role="link" class="<?php 
            echo esc_attr($image_align);
            ?>
" href="<?php 
            echo get_permalink();
            ?>
" title="<?php 
            the_title_attribute();
            ?>
"><?php 
            the_post_thumbnail($thumbnail_size, array('title' => the_title_attribute(array('echo' => false)), 'class' => 'post-thumb ' . $image_align));
            ?>
</a><?php 
            echo '</figure>';
        } else {
            $image = apply_filters('rtp_default_image_path', $default_img_path);
            if (isset($image) && !empty($image)) {
                $image_id = rtp_get_attachment_id_from_src($image, true);
                $alt = get_post_meta($image_id, '_wp_attachment_image_alt', true) ? get_post_meta($image_id, '_wp_attachment_image_alt', true) : 'Image';
                echo '<figure class="rtp-thumbnail-container ' . esc_attr($image_align) . ' ' . $thumbnail_frame . '">';
                ?>
				<a role="link" class="<?php 
                echo esc_attr($image_align);
                ?>
" href="<?php 
                echo get_permalink();
                ?>
" title="<?php 
                the_title_attribute();
                ?>
"><img role="img" class="<?php 
                echo 'post-thumb ' . esc_attr($image_align);
                ?>
 wp-post-image" title="<?php 
                the_title_attribute();
                ?>
" alt="<?php 
                echo esc_attr($alt);
                ?>
" <?php 
                echo rtp_get_image_dimensions($image);
                ?>
 src="<?php 
                echo esc_attr($image);
                ?>
" /></a><?php 
                echo '</figure>';
            }
        }
    }
}