Viewing 14 replies - 16 through 29 (of 29 total)
  • Thread Starter jaboli

    (@jaboli)

    https://www.nazthemes.com/download-wordpress-theme-v4/
    this is online check it out
    ???? = sales
    0 downloads

    It could be where you’ve placed the code in the page. If you have any other queries set up, it could throw off the post id as well. Make sure to remove any other custom queries from the page.

    Send the entire code of your single.php and I might be able to suggest a fix.

    Thread Starter jaboli

    (@jaboli)

    this is single.php it needs a while loop
    this is article section that you need

    <!--article-->
    							<?php if(have_posts()) : while(have_posts()) : the_post(); set_post_views (get_the_ID()); ?>
    							<div class="infokharid container-fluid" style="text-align:right;">
    								<div class="col-md-6 col-xs-12">
    									<div class="info">
    										<ul>
    											<li><a>???????? ? ??????? ????? ???? ??? ??</a></li>
    											<li><a>??? ? ??? ?????? ?????? ????</a></li>
    											<li><a>??????? ????????? ? ????? ??? ????</a></li>
    											<li><a>??????? ?? ???? ?????? ??? ??????</a></li>
    										</ul>
    									</div>
    								</div>
    								<div class="col-md-6 col-xs-12">
    									<div class="kharid">
    										<ul>
    											<li><a><?php the_title(); ?></a></li>
     <li><?php the_category(__(' , ','kubrick')) ?></li>
    <li>
    <?php
    $sales = edd_get_download_sales_stats( get_the_ID() );
    	$sales = $sales > 1 ? $sales . ' ????' : $sales . ' ????';
    	echo '<p>';
    	echo  $sales;
    	echo '<br/>';
    	echo sumobi_edd_get_download_count( get_the_ID() ) . ' downloads';
    	echo '</p>';
    ?>
    </li>
    <li style="background:#428bca;"><a href="<?php $post_meta = get_post_meta($post->ID, 'dm_pishnamayesh',true);echo $post_meta; ?>" style="color:white;" target="_blank">??? ????? ??????</a></li>
    											<?php $kharid = get_post_meta($post->ID, 'dm_kharid',true); echo do_shortcode('[purchase_link id="'.$kharid.'" text="????" style="button" color="green"]'); ?>
    										</ul>
    									</div>
    								</div>
    							</div>
    							<article>
    								<div class="title">
     <a class="view btn btn-success"><?php echo get_post_views (get_the_ID()); ?></a>
    										<i style="color:#767474;margin-left:5px;font-size:14px;" class="glyphicon glyphicon-align-justify"></i>
    <h1><a style="color:#767474;font-size:15px;" href="<?php the_permalink() ?>" target="_blank"><?php the_title(); ?></a></h1>
    																				<h4 style="color:#aaa;font-size:12px;padding-bottom:10px;border-bottom:1px solid #F2F2F2;">
    <i style="color:#767474;margin-left:5px;font-size:14px;" class="glyphicon glyphicon-bookmark"></i>
    <?php the_category(__(' , ','kubrick')) ?></h4>
    								</div>
    <img src="<?php $url= wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); echo $url; ?>" class="img-single img-responsive" >
    								<div class="content-single">
    									<?php the_content(); ?>
    									<?php if(get_post_meta($post->ID, 'dm_dl',true)){ ?>
    									<div class="links container-fluid" style="border:none;">
    <p><a style="background: #1bbc9b;border: 1px solid #1bbc9b;border-radius: 0.1875rem !important;padding: 10px;min-width: 150px;" class="btn btn-success" href="<?php $post_meta = get_post_meta($post->ID, 'dm_dl',true);echo $post_meta; ?>"><i class="glyphicon glyphicon-save" style="font-size: 15px;margin-left: 10px;"></i>?????? ?? ???? ??????</a>
    <?php if(get_post_meta($post->ID, 'dm_view',true)){ ?>
    	<a style="background:#3498db !important;border: 1px solid #3498db !important;border-radius: 0.1875rem !important;padding: 10px;min-width: 150px;" class="btn btn-danger" href="<?php $post_meta = get_post_meta($post->ID, 'dm_view',true);echo $post_meta; ?>" target="_blank"><i class="glyphicon glyphicon-picture" style="font-size: 15px;margin-left: 10px;"></i>??? ?????</a>
    											<?php } if(get_post_meta($post->ID, 'dm_afzune',true)){ ?>
    											<a style="background: #f39c11;border: 1px solid #f39c11;border-radius: 0.1875rem !important;padding: 10px;min-width: 150px;" class="btn btn-primary" href="<?php $post_meta = get_post_meta($post->ID, 'dm_afzune',true);echo $post_meta; ?>" target="_blank"><i class="glyphicon glyphicon-screenshot" style="font-size: 15px;margin-left: 10px;"></i>???? ???? ??????</a>
    											<?php } if(get_post_meta($post->ID, 'dm_hajm',true)){ ?>
    											<a style="background:#F04747;border:1px solid #F04747;border-radius: 0.1875rem !important;padding: 10px;min-width: 150px;" class="btn btn-info" target="_blank"><i class="glyphicon glyphicon-hdd" style="font-size: 15px;margin-left: 10px;"></i>??? ???? : <?php $post_meta = get_post_meta($post->ID, 'dm_hajm',true);echo $post_meta; ?></a>
    										</p>
    									</div>
    								<?php }} ?>
    
    								</div>
    								<div class="clear"></div>
    							</article>
    
    						<?php endwhile; endif; ?>

    Do you have any queries running in your header? I can see a list of products above the main product on your single page.

    Send the code for your header as well.

    Thread Starter jaboli

    (@jaboli)

    yes this is shop.php file

    <div class="shop col-xs-12">
      <div style="text-align:center;">
        <ul class="nav nav-tabs col-xs-12">
          <li class="active"><a data-toggle="tab" href="#all">???</a></li>
          <li><a data-toggle="tab" href="#shop1"><?php echo get_option('shortname_title1'); ?></a></li>
          <li><a data-toggle="tab" href="#shop2"><?php echo get_option('shortname_title2'); ?></a></li>
          <li><a data-toggle="tab" href="#shop3"><?php echo get_option('shortname_title3'); ?></a></li>
          <li><a data-toggle="tab" href="#shop4"><?php echo get_option('shortname_title4'); ?></a></li>
        </ul>
      </div>
      <div class="tab-content">
        <div id="all" class="tab-pane fade in active">
    
           <div class="hadie1" style="display:none;">
            <p> <i class="glyphicon glyphicon-gift"></i>?? ????? 40 ????? ?? ?????? ????? 95 : norouz95<i class="glyphicon glyphicon-gift"></i></p>
          </div>
          <div class="tavajoh">
            <p> <i class="glyphicon glyphicon-exclamation-sign"></i>?????? ???? ?????? ?????????? ???? ?????? ??? ??<i class="glyphicon glyphicon-exclamation-sign"></i></p>
          </div>
          <?php
    													$portfolio = new WP_Query(array(
    													'post_status' =>'publish',
    													'post_type' =>'post',
    													'cat' => get_option('shortname_cat0'),
    													'posts_per_page' => '6'
    													));
    													if($portfolio->have_posts()) : while($portfolio->have_posts()) : $portfolio->the_post();?>
          <div class="shop col-md-4 col-sm-6 col-xs-12">
            <article>
              <div class="img-thumb"><a href="<?php the_permalink() ?>" target="_blank">
             <?php the_post_thumbnail('shopimg'); ?>
             </a></div>
              <i style="color:#81AE33;margin-left:5px;" class="glyphicon glyphicon-shopping-cart"></i><a style="color:#81AE33;font-size:12px;font-weight:bold;" href="<?php the_permalink() ?>" target="_blank">
              <?php the_title(); ?>
              </a>
              <h4 style="font-size:12px;padding-bottom:10px;border-bottom:1px solid #F2F2F2;">
                <?php the_category(__(' , ','kubrick')) ?>
              </h4>
              <p><i style="color:gray;margin-left:5px;" class="glyphicon glyphicon-usd"></i><a style="color:gray;font-size:12px;">???? :
                <?php $post_meta = get_post_meta($post->ID, 'dm_gheymat',true);echo $post_meta; ?>
                </a></p>
              <p style="padding-bottom:5px;border-bottom:1px solid #F2F2F2;"><i style="color:gray;margin-left:5px;" class="glyphicon glyphicon-edit"></i><a style="color:gray;font-size:12px;">
                <?php $post_meta = get_post_meta($post->ID, 'dm_emkanat',true);echo $post_meta; ?>
                </a></p>
              <div style="clear:both;float:left;"> <a class="btn btn-success" style="font-size:11px;" href="<?php the_permalink() ?>" target="_blank">???? ????</a> <a class="btn btn-info" style="font-size:11px;" href="<?php $post_meta = get_post_meta($post->ID, 'dm_pishnamayesh',true);echo $post_meta; ?>" target="_blank">??? ????? ????</a>
                <?php if(get_post_meta($post->ID, 'dm_vije',true)){ ?>
                <a style="position: absolute;padding: 5px 10px;background: #FF5252;right: 21px;bottom: 10px;font-size: 12px;color: white;">??????? ????</a>
                <?php } ?>
              </div>
              <div class="clear"></div>
            </article>
          </div>
          <?php endwhile; endif;  wp_reset_query(); ?>
        </div>
        <div id="shop1" class="tab-pane fade">
    
           <div class="hadie1" style="display:none;">
            <p> <i class="glyphicon glyphicon-gift"></i>?? ????? 40 ????? ?? ?????? ????? 95 : norouz95<i class="glyphicon glyphicon-gift"></i></p>
          </div>
          <?php
    													$portfolio = new WP_Query(array(
    													'post_status' =>'publish',
    													'post_type' =>'post',
    													'cat' => get_option('shortname_cat1'),
    													'posts_per_page' => '6'
    													));
    													if($portfolio->have_posts()) : while($portfolio->have_posts()) : $portfolio->the_post();?>
          <div class="shop col-md-4 col-sm-6 col-xs-12">
            <article>
              <div class="img-thumb"><a href="<?php the_permalink() ?>" target="_blank">         <?php the_post_thumbnail('shopimg'); ?>
    </a></div>
              <i style="color:#81AE33;margin-left:5px;" class="glyphicon glyphicon-shopping-cart"></i><a style="color:#81AE33;font-size:12px;font-weight:bold;" href="<?php the_permalink() ?>" target="_blank">
              <?php the_title(); ?>
              </a>
              <h4 style="font-size:12px;padding-bottom:10px;border-bottom:1px solid #F2F2F2;">
                <?php the_category(__(' , ','kubrick')) ?>
              </h4>
              <p><i style="color:gray;margin-left:5px;" class="glyphicon glyphicon-usd"></i><a style="color:gray;font-size:12px;">???? :
                <?php $post_meta = get_post_meta($post->ID, 'dm_gheymat',true);echo $post_meta; ?>
                </a></p>
              <p style="padding-bottom:5px;border-bottom:1px solid #F2F2F2;"><i style="color:gray;margin-left:5px;" class="glyphicon glyphicon-edit"></i><a style="color:gray;font-size:12px;">
                <?php $post_meta = get_post_meta($post->ID, 'dm_emkanat',true);echo $post_meta; ?>
                </a></p>
              <div style="clear:both;float:left;"> <a class="btn btn-success" style="font-size:11px;" href="<?php the_permalink() ?>" target="_blank">???? ????</a> <a class="btn btn-info" style="font-size:11px;" href="<?php $post_meta = get_post_meta($post->ID, 'dm_pishnamayesh',true);echo $post_meta; ?>" target="_blank">??? ????? ????</a>
                <?php if(get_post_meta($post->ID, 'dm_vije',true)){ ?>
                <a style="position: absolute;padding: 5px 10px;background: #FF5252;right: 21px;bottom: 10px;font-size: 12px;color: white;">??????? ????</a>
                <?php } ?>
              </div>
              <div class="clear"></div>
            </article>
          </div>
          <?php endwhile; endif;  wp_reset_query(); ?>
        </div>
        <div id="shop2" class="tab-pane fade">
    
           <div class="hadie1" style="display:none;">
            <p> <i class="glyphicon glyphicon-gift"></i>?? ????? 40 ????? ?? ?????? ????? 95 : norouz95<i class="glyphicon glyphicon-gift"></i></p>
          </div>
          <?php
    													$portfolio = new WP_Query(array(
    													'post_status' =>'publish',
    													'post_type' =>'post',
    													'cat' => get_option('shortname_cat2'),
    													'posts_per_page' => '6'
    													));
    													if($portfolio->have_posts()) : while($portfolio->have_posts()) : $portfolio->the_post();?>
          <div class="shop col-md-4 col-sm-6 col-xs-12">
            <article>
              <div class="img-thumb"><a href="<?php the_permalink() ?>" target="_blank">         <?php the_post_thumbnail('shopimg'); ?>
    </a></div>
              <i style="color:#81AE33;margin-left:5px;" class="glyphicon glyphicon-shopping-cart"></i><a style="color:#81AE33;font-size:12px;font-weight:bold;" href="<?php the_permalink() ?>" target="_blank">
              <?php the_title(); ?>
              </a>
              <h4 style="font-size:12px;padding-bottom:10px;border-bottom:1px solid #F2F2F2;">
                <?php the_category(__(' , ','kubrick')) ?>
              </h4>
              <p><i style="color:gray;margin-left:5px;" class="glyphicon glyphicon-usd"></i><a style="color:gray;font-size:12px;">???? :
                <?php $post_meta = get_post_meta($post->ID, 'dm_gheymat',true);echo $post_meta; ?>
                </a></p>
              <p style="padding-bottom:5px;border-bottom:1px solid #F2F2F2;"><i style="color:gray;margin-left:5px;" class="glyphicon glyphicon-edit"></i><a style="color:gray;font-size:12px;">
                <?php $post_meta = get_post_meta($post->ID, 'dm_emkanat',true);echo $post_meta; ?>
                </a></p>
              <div style="clear:both;float:left;"> <a class="btn btn-success" style="font-size:11px;" href="<?php the_permalink() ?>" target="_blank">???? ????</a> <a class="btn btn-info" style="font-size:11px;" href="<?php $post_meta = get_post_meta($post->ID, 'dm_pishnamayesh',true);echo $post_meta; ?>" target="_blank">??? ????? ????</a>
                <?php if(get_post_meta($post->ID, 'dm_vije',true)){ ?>
                <a style="position: absolute;padding: 5px 10px;background: #FF5252;right: 21px;bottom: 10px;font-size: 12px;color: white;">??????? ????</a>
                <?php } ?>
              </div>
              <div class="clear"></div>
            </article>
          </div>
          <?php endwhile; endif;  wp_reset_query(); ?>
        </div>
        <div id="shop3" class="tab-pane fade">
    
           <div class="hadie1" style="display:none;">
            <p> <i class="glyphicon glyphicon-gift"></i>?? ????? 40 ????? ?? ?????? ????? 95 : norouz95<i class="glyphicon glyphicon-gift"></i></p>
          </div>
          <?php
    													$portfolio = new WP_Query(array(
    													'post_status' =>'publish',
    													'post_type' =>'post',
    													'cat' => get_option('shortname_cat3'),
    													'posts_per_page' => '6'
    													));
    													if($portfolio->have_posts()) : while($portfolio->have_posts()) : $portfolio->the_post();?>
          <div class="shop col-md-4 col-sm-6 col-xs-12">
            <article>
              <div class="img-thumb"><a href="<?php the_permalink() ?>" target="_blank">         <?php the_post_thumbnail('shopimg'); ?>
    </a></div>
              <i style="color:#81AE33;margin-left:5px;" class="glyphicon glyphicon-shopping-cart"></i><a style="color:#81AE33;font-size:12px;font-weight:bold;" href="<?php the_permalink() ?>" target="_blank">
              <?php the_title(); ?>
              </a>
              <h4 style="font-size:12px;padding-bottom:10px;border-bottom:1px solid #F2F2F2;">
                <?php the_category(__(' , ','kubrick')) ?>
              </h4>
              <p><i style="color:gray;margin-left:5px;" class="glyphicon glyphicon-usd"></i><a style="color:gray;font-size:12px;">???? :
                <?php $post_meta = get_post_meta($post->ID, 'dm_gheymat',true);echo $post_meta; ?>
                </a></p>
              <p style="padding-bottom:5px;border-bottom:1px solid #F2F2F2;"><i style="color:gray;margin-left:5px;" class="glyphicon glyphicon-edit"></i><a style="color:gray;font-size:12px;">
                <?php $post_meta = get_post_meta($post->ID, 'dm_emkanat',true);echo $post_meta; ?>
                </a></p>
              <div style="clear:both;float:left;"> <a class="btn btn-success" style="font-size:11px;" href="<?php the_permalink() ?>" target="_blank">???? ????</a> <a class="btn btn-info" style="font-size:11px;" href="<?php $post_meta = get_post_meta($post->ID, 'dm_pishnamayesh',true);echo $post_meta; ?>" target="_blank">??? ????? ????</a>
                <?php if(get_post_meta($post->ID, 'dm_vije',true)){ ?>
                <a style="position: absolute;padding: 5px 10px;background: #FF5252;right: 21px;bottom: 10px;font-size: 12px;color: white;">??????? ????</a>
                <?php } ?>
              </div>
              <div class="clear"></div>
            </article>
          </div>
          <?php endwhile; endif;  wp_reset_query(); ?>
        </div>
        <div id="shop4" class="tab-pane fade">
    
          <div class="hadie1" style="display:none;">
            <p> <i class="glyphicon glyphicon-gift"></i>?? ????? 40 ????? ?? ?????? ????? 95 : norouz95<i class="glyphicon glyphicon-gift"></i></p>
          </div>
          <?php
    													$portfolio = new WP_Query(array(
    													'post_status' =>'publish',
    													'post_type' =>'post',
    													'cat' => get_option('shortname_cat4'),
    													'posts_per_page' => '6'
    													));
    													if($portfolio->have_posts()) : while($portfolio->have_posts()) : $portfolio->the_post();?>
          <div class="shop col-md-4 col-sm-6 col-xs-12">
            <article>
              <div class="img-thumb"><a href="<?php the_permalink() ?>" target="_blank">         <?php the_post_thumbnail('shopimg'); ?>
    </a></div>
              <i style="color:#81AE33;margin-left:5px;" class="glyphicon glyphicon-shopping-cart"></i><a style="color:#81AE33;font-size:12px;font-weight:bold;" href="<?php the_permalink() ?>" target="_blank">
              <?php the_title(); ?>
              </a>
              <h4 style="font-size:12px;padding-bottom:10px;border-bottom:1px solid #F2F2F2;">
                <?php the_category(__(' , ','kubrick')) ?>
              </h4>
              <p><i style="color:gray;margin-left:5px;" class="glyphicon glyphicon-usd"></i><a style="color:gray;font-size:12px;">???? :
                <?php $post_meta = get_post_meta($post->ID, 'dm_gheymat',true);echo $post_meta; ?>
                </a></p>
              <p style="padding-bottom:5px;border-bottom:1px solid #F2F2F2;"><i style="color:gray;margin-left:5px;" class="glyphicon glyphicon-edit"></i><a style="color:gray;font-size:12px;">
                <?php $post_meta = get_post_meta($post->ID, 'dm_emkanat',true);echo $post_meta; ?>
                </a></p>
              <div style="clear:both;float:left;"> <a class="btn btn-success" style="font-size:11px;" href="<?php the_permalink() ?>" target="_blank">???? ????</a> <a class="btn btn-info" style="font-size:11px;" href="<?php $post_meta = get_post_meta($post->ID, 'dm_pishnamayesh',true);echo $post_meta; ?>" target="_blank">??? ????? ????</a>
                <?php if(get_post_meta($post->ID, 'dm_vije',true)){ ?>
                <a style="position: absolute;padding: 5px 10px;background: #FF5252;right: 21px;bottom: 10px;font-size: 12px;color: white;">??????? ????</a>
                <?php } ?>
              </div>
              <div class="clear"></div>
            </article>
          </div>
          <?php endwhile; endif;  wp_reset_query(); ?>
        </div>
      </div>
    </div>

    If you remove that code entirely what happens/what does your page look like?

    Also, send a link to one of your downloads that has sales for sure so we can see if they ever show.

    Thread Starter jaboli

    (@jaboli)

    i removed shop.php but it doesnt work yet
    https://www.nazthemes.com/nasim-wordpress-music/
    this product has 2 sales

    Thread Starter jaboli

    (@jaboli)

    this code show 10 sales number product
    how can it be just 1 specific product?!!

    <?php $query = new WP_Query( array( 'post_type' => 'download',
    'order'  => 'DESC',
    'orderby'  => 'meta_value_num',
    'meta_key'  => '_edd_download_earnings',
    'posts_per_page'  => 10
    ) );
    if ( $query ) { while( $query->have_posts() ) : $query->the_post();
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    - <?php $sales = get_post_meta( get_the_ID(), '_edd_download_sales', true ); echo ( is_null( $sales ) ? '0' : $sales ); ?> ????</li>
    
    <?php endwhile; } ?>

    I’m not sure where you got that code but it won’t work for what you want. You’re just querying all posts – so it will only retrieve your posts with the highest number.

    You need to use the code provided to you here.

    Your theme is breaking it somehow. You’ll have to break your theme’s code apart bit by bit until you find which part is causing it to break.

    Make sure the value of get_the_ID() matches the id of the download. You’ll have to do some debugging with your theme to figure that out.

    Thread Starter jaboli

    (@jaboli)

    how can i get id of specific download post?!

    Hey there,

    Sorry for the long delay on this. Somehow this post got missed. You can find the ID of any post by going to “Dashboard” > “Downloads” > “Edit”. When you are editing the post, look in the address bar and you’ll see “post=X”. The “X” will be the ID of the download post.

    If you are referring to getting the ID of the post through code, if you are in your theme you can use the WordPress function called get_the_ID(). To learn more about how that function works, check out this help document from WordPress’s codex:

    https://developer.www.ads-software.com/reference/functions/get_the_ID/

    Jaboli here is an another solution.
    First I have created a function that detects if post has shortcode anywhere in the content.

    `function price_id($tempCheck){
    $tempContent = get_the_content();
    $tempVerify = strpos($tempContent,$tempCheck);
    $pattern = ‘@purchase_link id=”(.*?)”@si’;
    preg_match_all($pattern,$tempContent,$matches);

    if(!$tempVerify === false) {
    $idnum = $matches[1][0];
    return $idnum;
    }
    }`

    I 95% attach just one file to my posts. you might need to tweak the function so it runs all the array vars.

    So this function gives us the id of the download file.

    after that i just use this code within the post loop:

    <?php echo edd_get_download_sales_stats(price_id("purchase_link id="));?>

    and it gives me the number of downloads for that file.

    Thread Starter jaboli

    (@jaboli)

    @timurtek thx for helping plz tell me where should i put these code?!!

    function price_id($tempCheck){
    $tempContent = get_the_content();
    $tempVerify = strpos($tempContent,$tempCheck);
    $pattern = '@purchase_link id="(.*?)"@si';
    preg_match_all($pattern,$tempContent,$matches);
    
    if(!$tempVerify === false) {
    $idnum = $matches[1][0];
    return $idnum;
    }
    }

    in functions.php?!

    Thread Starter jaboli

    (@jaboli)

    $pattern = ‘@purchase_link id=”(.*?)”@si’;
    (.*?)”@si whats this?! ??

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘display sales number for each product’ is closed to new replies.