Beispiel #1
0
					<div class="excerpt-thumb">
					<a href="<?php 
            the_permalink();
            ?>
" rel="bookmark" title="<?php 
            printf(esc_attr__('Permalink to %s', 'graphene'), the_title_attribute('echo=0'));
            ?>
">
						<?php 
            the_post_thumbnail(apply_filters('graphene_excerpt_thumbnail_size', 'thumbnail'));
            ?>
					</a>
					</div>
					<?php 
        } else {
            echo graphene_get_post_image(get_the_ID(), apply_filters('graphene_excerpt_thumbnail_size', 'thumbnail'), 'excerpt');
        }
        ?>
                
                <?php 
        /* Social sharing buttons at top of post */
        ?>
				<?php 
        if (stripos($graphene_settings['addthis_location'], 'top') !== false && $graphene_settings['show_addthis_archive']) {
            graphene_addthis(get_the_ID());
        }
        ?>
                
				<?php 
        /* The excerpt */
        ?>
Beispiel #2
0
 /**
  * This function determines which image to be used as the slider image based on user
  * settings, and returns the <img> tag of the the slider image.
  *
  * It requires the post's ID to be passed in as argument so that the user settings in
  * individual post / page can be retrieved.
 */
 function graphene_get_slider_image($post_id = NULL, $size = 'thumbnail', $urlonly = false, $default = '')
 {
     global $graphene_settings;
     // Throw an error message if no post ID supplied
     if ($post_id == NULL) {
         echo '<strong>ERROR:</strong> Post ID must be passed as an input argument to call the function <code>graphene_get_slider_image()</code>.';
         return;
     }
     // First get the settings
     $global_setting = $graphene_settings['slider_img'] ? $graphene_settings['slider_img'] : 'featured_image';
     $local_setting = graphene_get_post_meta($post_id, 'slider_img');
     $local_setting = $local_setting ? $local_setting : '';
     // Determine which image should be displayed
     $final_setting = $local_setting == '' ? $global_setting : $local_setting;
     // Build the html based on the final setting
     $html = '';
     if ($final_setting == 'disabled') {
         // image disabled
         return false;
     } elseif ($final_setting == 'featured_image') {
         // Featured Image
         if (has_post_thumbnail($post_id)) {
             if ($urlonly) {
                 $html = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size);
             } else {
                 $html .= get_the_post_thumbnail($post_id, $size);
             }
         }
     } elseif ($final_setting == 'post_image') {
         // First image in post
         $html = graphene_get_post_image($post_id, $size, '', $urlonly);
     } elseif ($final_setting == 'custom_url') {
         // Custom URL
         if (!$urlonly) {
             $html .= '';
             if ($local_setting != '') {
                 $html .= '<img src="' . esc_url(graphene_get_post_meta($post_id, 'slider_imgurl')) . '" alt="" />';
             } else {
                 $html .= '<img src="' . esc_url($graphene_settings['slider_imgurl']) . '" alt="" />';
             }
         } else {
             if ($local_setting != '') {
                 $html .= esc_url(graphene_get_post_meta($post_id, 'slider_imgurl'));
             } else {
                 $html .= esc_url($graphene_settings['slider_imgurl']);
             }
         }
     }
     if (!$html) {
         $html = $default;
     }
     // Returns the html
     return $html;
 }
Beispiel #3
0
/**
 * Adds the content panes in the homepage. The homepage panes are only displayed if using a static
 * front page, before the comments. It is also recommended that the comments section is disabled 
 * for the page used as the static front page.
*/
function graphene_homepage_panes()
{
    global $graphene_settings, $graphene_defaults, $in_homepage_panes;
    $in_homepage_panes = true;
    // Get the number of panes to display
    if ($graphene_settings['show_post_type'] == 'latest-posts' || $graphene_settings['show_post_type'] == 'cat-latest-posts') {
        $pane_count = $graphene_settings['homepage_panes_count'];
    } elseif ($graphene_settings['show_post_type'] == 'posts') {
        $pane_count = count(explode(',', $graphene_settings['homepage_panes_posts']));
    }
    // Build the common WP_Query() parameter first
    $args = array('orderby' => 'date', 'order' => 'DESC', 'post_type' => array('post', 'page'), 'posts_per_page' => $pane_count, 'ignore_sticky_posts' => 1);
    // args specific to latest posts
    if ($graphene_settings['show_post_type'] == 'latest-posts') {
        $args_merge = array('post_type' => array('post'));
        $args = array_merge($args, $args_merge);
    }
    // args specific to latest posts by category
    if ($graphene_settings['show_post_type'] == 'cat-latest-posts') {
        $args_merge = array('category__in' => graphene_object_id($graphene_settings['homepage_panes_cat'], 'category'));
        $args = array_merge($args, $args_merge);
    }
    // args specific to posts/pages
    if ($graphene_settings['show_post_type'] == 'posts') {
        $post_ids = $graphene_settings['homepage_panes_posts'];
        $post_ids = preg_split("/[\\s]*[,][\\s]*/", $post_ids, -1, PREG_SPLIT_NO_EMPTY);
        // post_ids are comma seperated, the query needs a array
        $post_ids = graphene_object_id($post_ids);
        $args_merge = array('post__in' => $post_ids, 'orderby' => 'post__in');
        $args = array_merge($args, $args_merge);
    }
    // Get the posts to display as homepage panes
    $panes = new WP_Query(apply_filters('graphene_homepage_panes_args', $args));
    $count = 0;
    ?>
    
    <?php 
    do_action('graphene_before_homepage_panes');
    ?>
    
    <div class="homepage_panes">
	
	<?php 
    while ($panes->have_posts()) {
        $panes->the_post();
        $count++;
        $alpha = $omega = false;
        if ($count % 2) {
            $alpha = true;
        } else {
            $omega = true;
        }
        ?>
		<div <?php 
        graphene_grid('homepage_pane clearfix', 8, 5, 4, $alpha, $omega);
        ?>
 id="homepage-pane-<?php 
        the_ID();
        ?>
">
        	<?php 
        do_action('graphene_homepage_pane_top');
        ?>
        
        	<a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        printf(__('Permalink to %s', 'graphene'), esc_attr(get_the_title()));
        ?>
">
        	<?php 
        /* Get the post's image */
        if (has_post_thumbnail(get_the_ID())) {
            $image = get_the_post_thumbnail(get_the_ID(), 'graphene-homepage-pane');
        } else {
            $image = graphene_get_post_image(get_the_ID(), 'graphene-homepage-pane', 'excerpt');
        }
        if ($image) {
            echo apply_filters('graphene_homepage_pane_image', $image, get_the_ID());
        }
        ?>
            </a>
            
            <?php 
        /* The post title */
        ?>
            <h3 class="post-title">
            	<a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        printf(__('Permalink to %s', 'graphene'), esc_attr(get_the_title()));
        ?>
"><?php 
        the_title();
        ?>
</a>
                <?php 
        do_action('homepage_pane_title');
        ?>
            </h3>
            
            <?php 
        /* The post excerpt */
        ?>
            <div class="post-excerpt">
            	<?php 
        the_excerpt();
        do_action('graphene_homepage_pane_content');
        ?>
            </div>
            
            <?php 
        /* Read more button */
        ?>
            <p class="post-comments">
            	<a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        printf(__('Permalink to %s', 'graphene'), esc_attr(get_the_title()));
        ?>
" class="block-button"><?php 
        _e('Read more', 'graphene');
        ?>
</a>
            </p>
            
            <?php 
        do_action('graphene_homepage_pane_bottom');
        ?>
            
        </div>
    <?php 
    }
    wp_reset_postdata();
    ?>
	</div>
	
	<?php 
    do_action('graphene_after_homepage_panes');
    unset($in_homepage_panes);
}