1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

limit number post per page

Discussion in 'WordPress' started by Tuhin1234, Sep 3, 2016.

  1. #1
    here is my query

        <?php
            $my_query = new WP_Query();
            $query_posts = $my_query->query($args);
           
            $my_query1 = new WP_Query($args);
            $pages = $my_query1->max_num_pages;
                if(!$pages)
                    $pages = 1;
    
            while ( $my_query->have_posts() ) :
                      $my_query->the_post();
    
            $params = array('pid'    => get_the_ID(),
                            'do'    => 'delete');
            $private_download = array('file_name'    => $nmfilemanager -> get_attachment_file_name( get_the_ID() ),
                                       'do'            => 'download');
    
            $urlDelete = $nmfilemanager -> fixRequestURI($params);
            $urlPrivateDownload = $nmfilemanager -> fixRequestURI($private_download);       
        $meta = get_post_meta(get_the_ID(), '_wp_attachment_metadata', true);
        $file_meta = json_decode($meta, true);
        ?>
    PHP:

     
    Tuhin1234, Sep 3, 2016 IP
  2. karjen

    karjen Active Member

    Messages:
    54
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    73
    #2
    try this, But I'am not sure if it will work with your query..
    <?php
    
       $args = array(                                   
                           'showposts' => 16, // Change the number to the number of post you want to show                                   
                    );
    
            $my_query = new WP_Query($args);          
            $pages = $my_query1->max_num_pages;
                if(!$pages)
                    $pages = 1;
    
            while ( $my_query->have_posts() ) :
                      $my_query->the_post();
    
            $params = array('pid'    => get_the_ID(),
                            'do'    => 'delete');
            $private_download = array('file_name'    => $nmfilemanager -> get_attachment_file_name( get_the_ID() ),
                                       'do'            => 'download');
    
            $urlDelete = $nmfilemanager -> fixRequestURI($params);
            $urlPrivateDownload = $nmfilemanager -> fixRequestURI($private_download);      
        $meta = get_post_meta(get_the_ID(), '_wp_attachment_metadata', true);
        $file_meta = json_decode($meta, true);
        ?>
    Code (markup):
     
    karjen, Sep 3, 2016 IP
  3. Tuhin1234

    Tuhin1234 Active Member

    Messages:
    178
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #3
    thanks sir, it work......
     
    Tuhin1234, Sep 3, 2016 IP