Sunday, 23 August 2020

112.wordpress pagination

 <?php 


global $wp_query;  
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$datanew WP_Query(array(
    'post_type'=>'portfolios'// your post type name
    'posts_per_page' => 2// post per page
    'paged' => $paged,
));

if($data->have_posts()) :
    while($data->have_posts())  : $data->the_post();
        echo  the_title();
    endwhile;

    $total_pages = $data->max_num_pages;

    if ($total_pages > 1){

        $current_page = max(1get_query_var('paged'));

        echo paginate_links(array(
            'base' => get_pagenum_link(1) . '%_%',
            'format' => '/page/%#%',
            'current' => $current_page,
            'total' => $total_pages,
            'prev_text'    => __('« prev'),
            'next_text'    => __('next »'),
        ));
    }
    ?>    
<?php else :?>
<h3><?php _e('404 Error&#58; Not Found'''); ?></h3>
<?php endif?>
<?php wp_reset_postdata();?>

Friday, 31 January 2020

Saturday, 25 January 2020

109.how to install xamp on ubuntu 18.04 lte system

https://vitux.com/how-to-install-xampp-on-your-ubuntu-18-04-lts-system/

https://www.youtube.com/watch?v=R5CUn5wGQGg

cd opt/lamp/htdocs=>project folder

ll or ls=>for listing files in it

sudo /opt/lampp/lampp start =>to start xamp

sudo gedit myphp.php=>create new file myphp.php

ls -al myphp.php=>to see the permission of file

sudo chmod +x myphp.php=>to change permission

sudo nano myphp.php=>open and edit file

Tuesday, 9 July 2019

107.laravel layout

https://www.cloudways.com/blog/create-laravel-blade-layout/

  1. <!doctype html>
  2. <html>
  3. <head>
  4. @include('includes.head')
  5. </head>
  6. <body>
  7. <div class="container">
  8. <header class="row">
  9. @include('includes.header')
  10. </header>
  11. <div id="main" class="row">
  12. @yield('content')
  13. </div>
  14. <footer class="row">
  15. @include('includes.footer')
  16. </footer>
  17. </div>
  18. @stack('scripts')
  19. </body>
  20. </html>

Monday, 22 April 2019