Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wordpress the loop

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

      <h2><?php the_title(); ?></h2>
      <?php the_content(); ?>

    <?php endwhile; else: ?>

      <h2><?php esc_html_e( '404 Error', 'phpforwp' ); ?></h2>
      <p><?php esc_html_e( 'Sorry, content not found.', 'phpforwp' ); ?></p>

<?php endif; ?>
Comment

wordpress custom loop

$args = array(
  'post_type'      => $post,
  'post_status'    => 'publish',
  'posts_per_page' => $post_total,
  'orderby'        => 'publish_date',
  'order'          => 'DESC'
);
$loop = new WP_Query( $args );

while ( $loop->have_posts() ): $loop->the_post();
	// Your code
endwhile;
wp_reset_postdata();
Comment

wordpress loop

<!------- WordPress Basic Loop ------->

<?php if ( have_posts() ) : ?>
	<?php while ( have_posts() ) : the_post(); ?>
		
        <?php the_title();?>
        <?php the_content();?>
        
	<?php endwhile; ?>
<?php endif; ?>
Comment

loop in loop wordpress

<?php
if (have_posts()) :
while (have_posts()) : the_post(); // the post loop
$temp_query = $wp_query; // store it
$args = array(
'paged' => $paged, // paginates
'post_type'=>'post',
'posts_per_page' => 3,
'order' => 'DESC'
);
$wp_query = new WP_Query($args);
while ($wp_query->have_posts()) : $wp_query->the_post();
// -- your new loop -- //
>endwhile;
if (isset($wp_query)) {$wp_query = $temp_query;} // restore loop
>endwhile;
endif;
?>
Comment

PREVIOUS NEXT
Code Example
Php :: parsefloat php 
Php :: laravel env production 
Php :: get price woocommerce product 
Php :: wp+get feature image 
Php :: php decode html special characters 
Php :: php split string by enter 
Php :: php array get first x elements 
Php :: carbon parse sunday 30 days ago 
Php :: preg_replace remove double quotes 
Php :: woocommerce custom sale banner, sash 
Php :: php ping time 
Php :: php preg_match special characters 
Php :: laravel model insert 
Php :: laravel collection tojson 
Php :: how to echo line number in php 
Php :: laravel created_at migration 
Php :: php move file 
Php :: laravel carbon human readable 
Php :: sleep function in php 
Php :: make model controller in single command 
Php :: js check if div is empty 
Php :: sum multiple fields separately in laravel 
Php :: Google_Service_Calendar Event Date Time 
Php :: wordpress my account url 
Php :: Internal error: xmlSchemaValidateChildElem, calling xmlRegExecPushString2(). 
Php :: laravel pagination publish command 
Php :: use wordpress functions in external php file 
Php :: php form detect if number has decimals 
Php :: decimal to binary php 
Php :: subtract some days php 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =