Пример #1
0
 /**
  * Get related posts attachments data slightly modified.
  *
  * @return array Attachments data.
  */
 function presscore_get_related_posts($options = array())
 {
     $default_options = array('select' => 'only', 'exclude_current' => true, 'args' => array());
     $options = wp_parse_args($options, $default_options);
     // exclude current post if in the loop
     if (in_the_loop() && $options['exclude_current']) {
         $options['args'] = array_merge($options['args'], array('post__not_in' => array(get_the_ID())));
     }
     $posts = presscore_get_posts_in_categories($options);
     update_post_thumbnail_cache($posts);
     $attachments_ids = array();
     $attachments_data_override = array();
     $posts_data = array();
     // get posts attachments id
     if ($posts->have_posts()) {
         global $post;
         $post_back = $post;
         while ($posts->have_posts()) {
             $posts->the_post();
             // thumbnail or first attachment id
             if (has_post_thumbnail()) {
                 $attachment_id = get_post_thumbnail_id();
             } else {
                 if ($attachment = presscore_get_first_image()) {
                     $attachment_id = $attachment->ID;
                 } else {
                     $attachment_id = 0;
                 }
             }
             switch (get_post_type()) {
                 case 'post':
                     $post_meta = presscore_new_posted_on('post');
                     break;
                 case 'dt_portfolio':
                     $post_meta = presscore_new_posted_on('dt_portfolio');
                     break;
                 default:
                     $post_meta = presscore_new_posted_on();
             }
             $post_data = array();
             /////////////////////////
             // attachment data //
             /////////////////////////
             $post_data['full'] = $post_data['width'] = $post_data['height'] = '';
             $meta = wp_get_attachment_image_src($attachment_id, 'full');
             if (!empty($meta)) {
                 $post_data['full'] = esc_url($meta[0]);
                 $post_data['width'] = absint($meta[1]);
                 $post_data['height'] = absint($meta[2]);
             }
             $post_data['thumbnail'] = wp_get_attachment_image_src($attachment_id, 'thumbnail');
             $post_data['caption'] = '';
             $post_data['video_url'] = esc_url(get_post_meta($attachment_id, 'dt-video-url', true));
             $post_data['mime_type_full'] = get_post_mime_type($attachment_id);
             $post_data['mime_type'] = dt_get_short_post_myme_type($attachment_id);
             $post_data['ID'] = $attachment_id;
             $post_data['image_attachment_data'] = array('caption' => $post_data['caption'], 'description' => wp_kses_post(get_post_field('post_content', $attachment_id)), 'title' => presscore_imagee_title_is_hidden($attachment_id) ? '' : get_the_title($attachment_id), 'permalink' => get_permalink($attachment_id), 'video_url' => $post_data['video_url'], 'ID' => $attachment_id);
             ///////////////////
             // post data //
             ///////////////////
             $post_data['title'] = get_the_title();
             $post_data['permalink'] = get_permalink();
             $post_data['link'] = presscore_get_project_link('project-link');
             $post_data['description'] = get_the_excerpt();
             $post_data['alt'] = get_the_title();
             $post_data['parent_id'] = get_the_ID();
             $post_data['meta'] = $post_meta;
             // save data
             $posts_data[] = $post_data;
         }
         $post = $post_back;
         setup_postdata($post);
     }
     return $posts_data;
 }
Пример #2
0
 function presscore_get_project_rollover_link_icon()
 {
     $config = presscore_get_config();
     $rollover_icon = '';
     if ($config->get('show_links')) {
         $project_link = presscore_get_project_link('project-link');
         if ($project_link) {
             $rollover_icon = $project_link;
         }
     }
     return $rollover_icon;
 }
<?php

/**
 * Portfolio project single links content part
 *
 * @package vogue
 * @since 1.0.0
 */
// File Security Check
if (!defined('ABSPATH')) {
    exit;
}
// link pages
wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'the7mk2'), 'after' => '</div>', 'echo' => false));
$share_buttons = presscore_display_share_buttons_for_post('portfolio_post', array('echo' => false));
$project_link = presscore_get_project_link('h5-size btn-project-link');
if ($share_buttons || $project_link) {
    echo '<div class="project-content-btn">';
    echo $project_link, $share_buttons;
    echo '</div>';
}
<?php

/**
 * Portfolio project single links content part
 *
 * @package vogue
 * @since 1.0.0
 */
// File Security Check
if (!defined('ABSPATH')) {
    exit;
}
// link pages
wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', LANGUAGE_ZONE), 'after' => '</div>', 'echo' => false));
$share_buttons = presscore_display_share_buttons('portfolio_post', array('echo' => false));
$project_link = presscore_get_project_link('dt-btn-m btn-project-link');
if ($share_buttons || $project_link) {
    echo '<div class="project-content-btn">';
    echo $project_link, $share_buttons;
    echo '</div>';
}
Пример #5
0
        $slider_classes = array('alignnone');
        if ('grid' == $config->get('layout')) {
            $slider_classes[] = 'slider-simple';
        } else {
            $slider_classes[] = 'slider-masonry';
        }
        echo presscore_get_project_media_slider($slider_classes);
    }
}
// create post buttons set
$post_buttons = '';
if ($show_post_buttons) {
    if ($desc_on_hover) {
        $post_buttons .= presscore_post_details_link($post->ID, 'project-details');
        if ($show_links) {
            $post_buttons .= presscore_get_project_link('project-link');
        }
        if ($show_zoom) {
            $post_buttons .= $zoom_link;
        }
    } else {
        $post_buttons .= $details_button . ($show_links ? $project_link : '') . ($show_zoom ? $zoom_link : '');
    }
    if (1 == $buttonts_count) {
        $post_buttons = str_replace('class="', 'class="big-link ', $post_buttons);
    }
}
if ($show_content && $desc_on_hover) {
    $post_buttons .= presscore_post_edit_link();
}
if ($post_buttons) {
Пример #6
0
 /**
  * Get related posts attachments data slightly modified.
  *
  * @return array Attachments data.
  */
 function presscore_get_related_posts($options = array())
 {
     $default_options = array('select' => 'only', 'exclude_current' => true, 'args' => array());
     $options = wp_parse_args($options, $default_options);
     // exclude current post if in the loop
     if (in_the_loop() && $options['exclude_current']) {
         $options['args'] = array_merge($options['args'], array('post__not_in' => array(get_the_ID())));
     }
     $posts = presscore_get_posts_in_categories($options);
     $attachments_ids = array();
     $attachments_data_override = array();
     $posts_data = array();
     // get posts attachments id
     if ($posts->have_posts()) {
         while ($posts->have_posts()) {
             $posts->the_post();
             // thumbnail or first attachment id
             if (has_post_thumbnail()) {
                 $attachments_ids[] = get_post_thumbnail_id();
             } else {
                 if ($attachment = presscore_get_first_image()) {
                     $attachments_ids[] = $attachment->ID;
                 } else {
                     $attachments_ids[] = 0;
                 }
             }
             switch (get_post_type()) {
                 case 'post':
                     $post_meta = presscore_new_posted_on('post');
                     break;
                 case 'dt_portfolio':
                     $post_meta = presscore_new_posted_on('dt_portfolio');
                     break;
                 default:
                     $post_meta = presscore_new_posted_on();
             }
             $attachments_data_override[] = array('permalink' => get_permalink(), 'link' => presscore_get_project_link('project-link'), 'title' => get_the_title(), 'description' => get_the_excerpt(), 'alt' => get_the_title(), 'parent_id' => get_the_ID(), 'meta' => $post_meta);
         }
         wp_reset_postdata();
     }
     if ($attachments_ids) {
         // what we want
         $attachments_data = presscore_get_attachment_post_data($attachments_ids);
         // what we get
         $attachments_data_ids = array();
         if ($attachments_data) {
             $attachments_data_ids = wp_list_pluck($attachments_data, 'ID');
         }
         $default_image = presscore_get_default_image();
         foreach ($attachments_ids as $key => $id) {
             $attachments_data_key = array_search($id, $attachments_data_ids);
             // if there are image - add it to array
             if (false !== $attachments_data_key) {
                 $posts_data[$key] = $attachments_data[$attachments_data_key];
                 // or add noimage
             } else {
                 $posts_data[$key] = array('full' => $default_image[0], 'width' => $default_image[1], 'height' => $default_image[2]);
             }
             if (isset($attachments_data_override[$key])) {
                 $posts_data[$key] = array_merge($posts_data[$key], $attachments_data_override[$key]);
             }
         }
     }
     return $posts_data;
 }
Пример #7
0
if ($config->get('show_excerpts')) {
    ?>

				<?php 
    the_excerpt();
    ?>

			<?php 
}
?>

			<p>
				<?php 
echo presscore_post_details_link();
if ($config->get('show_links')) {
    echo presscore_get_project_link('link btn-link');
}
echo presscore_post_edit_link();
?>
			</p>

		</div>

	</div>
</article><!-- #post-<?php 
the_ID();
?>
 -->

<?php 
do_action('presscore_after_post');
Пример #8
0
    }
    // layout
    switch ($media_layout) {
        case 'left':
            $before_content .= sprintf('%s<div class="wf-cell %s project-content">', $media_html_with_wrap, $content_container_class);
            $after_content = '</div>' . $after_content;
            break;
        case 'right':
            $before_content .= '<div class="wf-cell ' . $content_container_class . ' project-content">';
            $after_content .= sprintf('%s', $media_html_with_wrap);
            break;
    }
    // if media disabled
} else {
    $before_content .= '<div class="wf-cell wf-1 project-content">';
    $after_content = '</div>' . $after_content;
}
$show_navigation = presscore_is_post_navigation_enabled();
$project_link = presscore_get_project_link('btn-link btn-project-link');
echo $before_content;
if ($show_navigation || $project_link) {
    echo '<div class="project-navigation">';
    presscore_post_navigation_controller();
    echo $project_link;
    echo '</div>';
}
the_content();
echo presscore_new_posted_on('dt_portfolio');
presscore_display_share_buttons('portfolio_post');
wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', LANGUAGE_ZONE), 'after' => '</div>'));
echo $after_content;