Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter quangtuyen1601

    (@quangtuyen1601)

    it seems you don’t understand what I mean. when I use
    [wpp range=’last7days’ limit=10 stats_views=1 order_by=’views’ stats_taxonomy=1 title_length=35]
    then the default taxonomy display shows the word “under” in front.
    I want to remove/hide the word “under”, only display the called taxonomy.
    In addition, in the output file I also see some fixed words, there is no class for css to hide them like in the picture.
    I can remove it in the output file, but I’m afraid of updating later.

    Thread Starter quangtuyen1601

    (@quangtuyen1601)

    i found the reason thank you very much ??

    Thread Starter quangtuyen1601

    (@quangtuyen1601)

    I did it this way: How To: Sorting a custom query by views (All time, monthly, weekly, or daily)

    But when it comes to displaying the number of views for each post, it only shows 0 views

    <?php echo do_shortcode('[wpp_views_count include_views_text="0" post_id=' . get_the_ID() . ']'); ?>
    function render_hot_stories_shortcode($atts) {
    // L?y tham s? shortcode
    $atts = shortcode_atts(array(
    'num' => 5, // S? l??ng bài vi?t c?n l?y
    ), $atts, 'hot_stories');

    $args = array(
    'post_type' => 'post',
    'meta_key' => 'views_total',
    'orderby' => 'meta_value_num',
    'order' => 'DESC',
    'posts_per_page' => intval($atts['num']), // L?y s? l??ng bài vi?t t? tham s? shortcode
    );

    $top_posts = new WP_Query($args);
    ob_start(); // B?t ??u l?u tr? output ?? tr? v? sau

    if ($top_posts->have_posts()) {
    ?>
    <div uk-slider="autoplay: 1; autoplayInterval: 3000;" class="uk-margin uk-text-center uk-slider uk-slider-container" role="region" aria-roledescription="carousel">
    <div class="uk-position-relative">
    <ul class="uk-slider-items uk-grid uk-grid-small uk-grid-match" aria-live="off" role="presentation">
    <?php while ($top_posts->have_posts()) : $top_posts->the_post(); ?>
    <li class="" aria-hidden="false">
    <div class="el-item uk-grid-item-match">
    <a class="uk-cover-container uk-transition-toggle uk-display-block uk-link-toggle" href="<?php the_permalink(); ?>" uk-scroll="">
    <picture>
    <?php if (has_post_thumbnail()) : ?>
    <source type="image/webp" srcset="<?php echo get_the_post_thumbnail_url(get_the_ID(), 'full'); ?> 158w" sizes="(min-width: 158px) 158px">
    <img decoding="async" src="<?php echo get_the_post_thumbnail_url(get_the_ID(), 'full'); ?>" width="158" height="258" alt="" class="el-image uk-transition-opaque">
    <?php else : ?>
    <source type="image/webp" srcset="<?php echo get_stylesheet_directory_uri() . '/images/Chua-co-anh-bia.png'; ?> 158w" sizes="(min-width: 158px) 158px">
    <img decoding="async" src="<?php echo get_stylesheet_directory_uri() . '/images/Chua-co-anh-bia.png'; ?>" width="158" height="258" alt="" class="el-image uk-transition-opaque">
    <?php endif; ?>
    </picture>
    <div class="uk-position-bottom-center uk-overlay-primary">
    <div class="uk-overlay uk-padding-remove uk-margin-remove-first-child">
    <h3 class="el-title uk-h5 uk-margin-top uk-margin-remove-bottom"><?php the_title(); ?></h3>
    <div class="el-meta uk-text-emphasis">
    <div class="uk-text-center" uk-grid>
    <div class="uk-width-1-2">
    <?php echo do_shortcode('[count_chap post_id="' . get_the_ID() . '"]'); ?>
    </div>
    <div class="uk-width-1-2">
    <img src="/wp-content/themes/theme-child/images/view.svg" alt="views" title="views" width="16" height="16" style="vertical-align: middle;" uk-svg>
    <?php echo do_shortcode('[wpp_views_count include_views_text="0" post_id=' . get_the_ID() . ']'); ?>
    </div>
    </div>
    </div>
    </div>
    </div>
    </a>
    </div>
    </li>
    <?php endwhile; ?>
    </ul>
    </div>
    </div>
    <?php
    }

    wp_reset_postdata(); // ??t l?i d? li?u sau khi query
    return ob_get_clean(); // Tr? v? output ?? l?u tr?
    }

    add_shortcode('hot_stories', 'render_hot_stories_shortcode');
    Thread Starter quangtuyen1601

    (@quangtuyen1601)

    Hi, let me ask another question, I want to get the list of posts with the most views without using wpp_get_mostpopular is that possible?

    It seems that using meta_key is not possible.

    Thread Starter quangtuyen1601

    (@quangtuyen1601)

    I tried and succeeded, you are very enthusiastic, thank you very much

    Thread Starter quangtuyen1601

    (@quangtuyen1601)

    hello @hcabrera, I got a 404 error for wpp_params.api_url + ‘/v2/views/’ and it doesn’t update the view from the chapter to the post anymore

    Thread Starter quangtuyen1601

    (@quangtuyen1601)

    It was amazing, it worked very well.
    Thank you very much.

    Thread Starter quangtuyen1601

    (@quangtuyen1601)

    Thank you, I will be here waiting for you. Looking forward to your support

    Thread Starter quangtuyen1601

    (@quangtuyen1601)

    huhu

    So is there no available function like the way I used to count views by post id?

    I searched 49 help pages but did not find any case like mine. ??

    Hope you support back soon

    Thread Starter quangtuyen1601

    (@quangtuyen1601)

    I asked chatgpt and there is this way
    $chap_id = get_the_ID();

    $post_id = wp_get_post_parent_id($chap_id);
    to determine post ID from chap ID.
    Does your plugin support what I want?
    Use the post ID placed in the chap to count views for the post

    Thread Starter quangtuyen1601

    (@quangtuyen1601)

    Thank you for responding,
    These are the codes I compiled online and asked chatgpt to build them.
    Basically, a chapter is just a custom post, I don’t really understand how to define it.
    For example, when I call the post’s chapter list, the query is like this
    $post_id = get_the_ID(); $query_args = array( 'post_type' => 'chap', 'post_parent' => $post_id, )
    Before using your plugin, I used code like this
    // function to count views. function setPostViews($postID) { $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); }else{ $count++; update_post_meta($postID, $count_key, $count); } }
    and in single-chap.php
    $parent = $post->post_parent; $ID = get_the_ID(); tw_views($parent);
    then it will count the views of the chapters for the post

Viewing 11 replies - 1 through 11 (of 11 total)