Kod

ZMIENIONE PLIKI

ADRES: /wp-content/themes/porto/content-post-large.php
OPIS: dodanie kodu odpowiadającego za wyświetlanie liczby wyświetleń wpisu
AKTUALIZACJA: 22.07.2016

<?php
global $porto_settings;

$post_layout = 'large';

$show_date = in_array('date', $porto_settings['post-metas']);
$show_format = $porto_settings['post-format'] && get_post_format();
$post_class = array();
$post_class[] = 'post post-' . $post_layout;
if (!($show_date || $show_format))
    $post_class[] = 'hide-post-date';
?>

<article <?php post_class($post_class); ?>>

    <?php // Post Slideshow ?>
    <?php get_template_part('slideshow', 'large'); ?>

    <?php if ($show_date || $show_format) : ?>
        <div class="post-date">
            <?php
            porto_post_date();
            porto_post_format();
            ?>
        </div>
    <?php endif; ?>

    <div class="post-content">

        <h2 class="entry-title"><?php the_title(); ?></h2>
        <?php porto_render_rich_snippets( false ); ?>
        <div class="post-meta">
		<span>
			<?php if(function_exists('the_views')) { the_views(); } ?> <!--LICZNIK ODWIEDZIN-->
			</span>
            <?php if (in_array('author', $porto_settings['post-metas'])) : ?><span><i class="fa fa-user"></i> <?php echo __('By', 'porto'); ?> <?php the_author_posts_link(); ?></span><?php endif; ?>
            <?php
            $cats_list = get_the_category_list(', ');
            if ($cats_list && in_array('cats', $porto_settings['post-metas'])) : ?>
                <span><i class="fa fa-folder-open"></i> <?php echo $cats_list ?></span>
            <?php endif; ?>
            <?php
            $tags_list = get_the_tag_list('', ', ');
            if ($tags_list && in_array('tags', $porto_settings['post-metas'])) : ?>
                <span><i class="fa fa-tag"></i> <?php echo $tags_list ?></span>
            <?php endif; ?>
            <?php if (in_array('comments', $porto_settings['post-metas'])) : ?><span><i class="fa fa-comments"></i> <?php comments_popup_link(__('0 Comments', 'porto'), __('1 Comment', 'porto'), '% '.__('Comments', 'porto')); ?></span><?php endif; ?>
			
            <?php
            if (function_exists('Post_Views_Counter') && Post_Views_Counter()->options['display']['position'] == 'manual') {
                $post_count = do_shortcode('[post-views]');
                if ($post_count) {
                    echo $post_count;
                }
            }
            ?>
        </div>

        <div class="entry-content">
            <?php
            the_content();
            wp_link_pages( array(
                'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'porto' ) . '</span>',
                'after'       => '</div>',
                'link_before' => '<span>',
                'link_after'  => '</span>',
                'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'porto' ) . ' </span>%',
                'separator'   => '<span class="screen-reader-text">, </span>',
            ) );
            ?>
        </div>

    </div>

    <div class="post-gap"></div>

    <?php
    $share = porto_get_meta_value('post_share');
    if ($porto_settings['share-enable'] && 'no' !== $share && ('yes' === $share || ('yes' !== $share && $porto_settings['post-share']))) : ?>
        <div class="post-block post-share">
            <h3><i class="fa fa-share"></i><?php _e('Share this post', 'porto') ?></h3>
            <?php get_template_part('share') ?>
        </div>
    <?php endif; ?>

    <?php if ($porto_settings['post-author']) : ?>
        <div class="post-block post-author clearfix">
            <h3><i class="fa fa-user"></i><?php _e('Author', 'porto') ?></h3>
            <div class="img-thumbnail">
                <?php echo get_avatar(get_the_author_meta('email'), '80'); ?>
            </div>
            <p><strong class="name"><?php the_author_posts_link(); ?></strong></p>
            <p><?php the_author_meta("description"); ?></p>
        </div>
    <?php endif; ?>

    <div class="post-gap"></div>

    <?php if ($porto_settings['post-comments']) : ?>
        <?php
        wp_reset_postdata();
        comments_template();
        ?>
    <?php endif; ?>

</article>

ADRES: /wp-content/plugins/simple-download-monitor/includes/templates/fancy2/sdm-fancy-2.php
OPIS: treść guzika „Pobierz” oraz ilość wyświetlanych wyników w wierszu
AKTUALIZACJA: 28.09.2016

<?php

//TODO write a function for doing grid display then the conditional function calls this grid display function

function sdm_generate_fancy2_latest_downloads_display_output($get_posts, $args) {

    $output = "";
    $output .= '<link type="text/css" rel="stylesheet" href="' . WP_SIMPLE_DL_MONITOR_URL . '/includes/templates/fancy2/sdm-fancy-2-styles.css?ver=' . WP_SIMPLE_DL_MONITOR_VERSION . '" />';

    $count = 1;
    //$output .= '<ul class="sdm_fancy2_category_items">';
    foreach ($get_posts as $item) {
        $id = $item->ID;  //Get the post ID
        $button_text = isset($args['button_text'])? $args['button_text'] : '';
        $new_window = isset($args['new_window'])? $args['new_window'] : '';
        $show_size = isset($args['show_size'])? $args['show_size'] : '';
        $show_version = isset($args['show_version'])? $args['show_version'] : '';
    
        //Create a args array
        $args = array(
            'id' => $id,
            'fancy' => '2',
            'button_text' => $button_text,
            'new_window' => $new_window,
            'css_class' => 'sdm_fancy2_grid',
            'show_size' => $show_size,
            'show_version' => $show_version,            
        );
        $output .= sdm_generate_fancy2_display_output($args);

        if ($count % 4 == 0) {//Clear after every 3 items in the grid
            $output .= '<div class="sdm_clear_float"></div>';
        }
        $count++;
    }
    //$output .= '</ul>';
    $output .= '<div class="sdm_clear_float"></div>';
    return $output;
}

function sdm_generate_fancy2_category_display_output($get_posts, $args) {

    $output = "";
    $output .= '<link type="text/css" rel="stylesheet" href="' . WP_SIMPLE_DL_MONITOR_URL . '/includes/templates/fancy2/sdm-fancy-2-styles.css?ver=' . WP_SIMPLE_DL_MONITOR_VERSION . '" />';

    $count = 1;
    //$output .= '<ul class="sdm_fancy2_category_items">';
    foreach ($get_posts as $item) {
        $id = $item->ID;  //Get the post ID
        $button_text = isset($args['button_text'])? $args['button_text'] : '';
        $new_window = isset($args['new_window'])? $args['new_window'] : '';
        $show_size = isset($args['show_size'])? $args['show_size'] : '';
        $show_version = isset($args['show_version'])? $args['show_version'] : '';
        
        //Create a args array
        $args = array(
            'id' => $id,
            'fancy' => '2',
            'button_text' => $button_text,
            'new_window' => $new_window,
            'css_class' => 'sdm_fancy2_grid',
            'show_size' => $show_size,
            'show_version' => $show_version,            
        );
        $output .= sdm_generate_fancy2_display_output($args);

        if ($count % 4 == 0) {//Clear after every 3 items in the grid
            $output .= '<div class="sdm_clear_float"></div>';
        }
        $count++;
    }
    //$output .= '</ul>';
    $output .= '<div class="sdm_clear_float"></div>';
    return $output;
}

/*
 * Generates the output of a single item using fancy2 sytle 
 * $args array can have the following parameters
 * id, fancy, button_text, new_window
 */

function sdm_generate_fancy2_display_output($args) {

    $shortcode_atts = sanitize_sdm_create_download_shortcode_atts($args);

    // Make shortcode attributes available in function local scope.
    extract($shortcode_atts);

    // Check the download ID
    if ( empty($id) ) {
        return '<div class="sdm_error_msg">Error! The shortcode is missing the ID parameter. Please refer to the documentation to learn the shortcode usage.</div>';
    }

    // See if new window parameter is set
    $window_target = empty($new_window) ? '_blank' : '_blank';

    $homepage = get_bloginfo('url');
    $download_url = $homepage . '/?smd_process_download=1&download_id=' . $id;
    $download_button_code = '<a href="' . $download_url . '" class="sdm_fancy2_download" target="' . $window_target . '">' . Pobierz . '</a>';

    // Check to see if the download link cpt is password protected
    $get_cpt_object = get_post($id);
    $cpt_is_password = !empty($get_cpt_object->post_password) ? 'yes' : 'no';  // yes = download is password protected;    
    if ($cpt_is_password !== 'no') {//This is a password protected download so replace the download now button with password requirement
        $download_button_code = sdm_get_password_entry_form($id);
    }

    // Get item thumbnail
    $item_download_thumbnail = get_post_meta($id, 'sdm_upload_thumbnail', true);
    $isset_download_thumbnail = isset($item_download_thumbnail) && !empty($item_download_thumbnail) ? '<img class="sdm_fancy2_thumb_image" src="' . $item_download_thumbnail . '" />' : '';

    // Get item title
    $item_title = get_the_title($id);

    // Get item description
    $isset_item_description = sdm_get_item_description_output($id);

    //Get item file size
    $item_file_size = get_post_meta($id, 'sdm_item_file_size', true);
    $isset_item_file_size = (isset($args['show_size']) && isset($item_file_size)) ? $item_file_size : '';//check if show_size is enabled and if there is a size value

    //Get item version
    $item_version = get_post_meta($id, 'sdm_item_version', true);
    $isset_item_version = (isset($args['show_version']) && isset($item_version)) ? $item_version : '';//check if show_version is enabled and if there is a version value

    
    $css_class = isset($args['css_class']) ? $args['css_class'] : '';
    $output = '';
    $output .= '<div class="sdm_fancy2_item ' . $css_class . '">';
    $output .= '<div class="sdm_fancy2_wrapper">';

    $output .= '<div class="sdm_fancy2_download_item_top">';
    $output .= '<div class="sdm_fancy2_download_thumbnail">' . $isset_download_thumbnail . '</div>';
    $output .= '</div>'; //End of .sdm_download_item_top

    $output .= '<div class="sdm_fancy2_download_title">' . $item_title . '</div>';
    
    if (!empty($isset_item_file_size)) {//Show file size info if specified in the shortcode
        $output .= '<div class="sdm_fancy2_download_size">';
        $output .= '<span class="sdm_fancy2_download_size_label">' . __('Size: ', 'simple-download-monitor') . '</span>';
        $output .= '<span class="sdm_fancy2_download_size_value">' . $isset_item_file_size . '</span>';
        $output .= '</div>';
    }

    if (!empty($isset_item_version)) {//Show version info if specified in the shortcode
        $output .= '<div class="sdm_fancy2_download_version">';
        $output .= '<span class="sdm_fancy2_download_version_label">' . __('Version: ', 'simple-download-monitor') . '</span>';
        $output .= '<span class="sdm_fancy2_download_version_value">' . $isset_item_version . '</span>';
        $output .= '</div>';
    }
    
    $output .= '<div class="sdm_fancy2_download_link">' . $download_button_code . '</div>';

    $output .= '</div>'; //end .sdm_fancy2_item
    $output .= '</div>'; //end .sdm_fancy2_wrapper

    return $output;
}