I am creating a site with WordPress.
Also, when creating a list of articles on the archive page,
I would like to create a pageation and change the size of the images in the first and second articles.
I managed to do the above, but the contents of the first and second lines of the article
It's the same.
Multi-post (https://teratail.com/questions/5069i012dnih3u)
(https://qiita.com/keikkkk/questions/6b69fb04bd4d1c85560c)
Tried
( 'offset' = > 1, image description)
Entering the above code will not fix it.
Also, since I'm an amateur, I don't understand the rules of PHP.
This may be the reason why you don't know why.
PHP
<?php get_header();?>
<section class="blog-archive-wrapper">
<div class="blog-archive-wrapper-second">
<div class="blog-archive-outer">
<h2class="blog-archive-outer-title">New arrivals </h2>
<div>
<?php if(have_posts()):?>
<?php while(have_posts()):the_post();?>
<?php
$paged=get_query_var('paged') ?get_query_var('paged'):1;
$information = new WP_Query(array(
'post_type' = > 'post',
'paged' = > $paged,
'post_status' = > 'public',
'posts_per_page' = > 1,
));
?>
<ul><!---loop-->
<li>
<?php if($wp_query->current_post==0){?>
<a href="<?php the_permalink();?>"class="blog-item">/a>
<div class="blog-item-thumbnail-content">
<div class="blog-list-wrapper-second">
<?php//Show eye catch start?>
<div class="blog-item-thumbnail-second">
<?php if(has_post_thumbnail()):?>
<div class="thumbnail-image-second"><?php the_post_thumbnail(array(240,148));?></div>
<?php endif;?>
</div>
<?php//end?> to display eye catch
</div>
<div class="blog-list-category">
<?php$cat=$cat[0];?>
<p class="blog-list-category-title"><?php echo get_cat_name($cat->term_id);?></p>
</div>
<div class="blog-item-content">
<p class="blog-item-day-second">?php the_time('Y-m-d');?>/p>
<?php//start to display title?>
<h3class="blog-item-title">
<?phpechomb_substr($post->post_title,0,30).'...';?>
</h3>
<?php//end?> to display the title
<?php//start to display excerpts?>
<?php the_excerpt();?>
<?php//end?> to display excerpts
</div>
</div>
<?php}?>
<?php
$args = array(
'posts_per_page' = > 9,
'offset' = > 1,
);
$the_query=newWP_Query($args);
?>
<div class="blog-list-category">
<?php$cat=get_the_category();?>
<?php$cat=$cat[0];?>
<p class="blog-list-category-title"><?php echo get_cat_name($cat->term_id);?></p>
</div>
<div class="blog-list-list-item">
<a href="<?php the_permalink();?>"class="blog-item">/a>
<div class="blog-item-thumbnail-content-second">
<div class="blog-list-wrapper">
<?php//Show eye catch start?>
<div class="blog-item-thumbnail-second">
<?php if(has_post_thumbnail()):?>
<div class="thumbnail-image"><?php the_post_thumbnail(array(240,179));?>/div>
<?php endif;?>
</div>
<?php//end?> to display eye catch
</div>
<div class="blog-item-content">
<p class="blog-item-day-second">?php the_time('Y-m-d');?>/p>
<?php//start to display title?>
<h3class="blog-item-title">
<?phpechomb_substr($post->post_title,0,30).'...';?>
</h3>
<?php//end?> to display the title
<?php//start to display excerpts?>
<p class="blog-item-read">
<?php the_excerpt();?>
</p>
<?php//end?> to display excerpts
</div>
</div>
</div>
<?php endwhile;?>
</div>
</li>
</ul>
<?php
// Reset Subquery
wp_reset_postdata();
?>
<?php
if(function_exists('wp_pagenavi'){
wp_pagenavi(array('query'=>$information)));
}
?>
<?php endif;?>
</div>
</div>
</section>
<?php get_footer();?>
The first and second lines are the same.
It doesn't seem to work either, and the total number of displays will not be 10.11 will be displayed.
php html wordpress
<div class="pagination">
<div class="list-box">
<ul>
<?php
$paged=(get_query_var('paged'))?get_query_var('paged'):1;
$the_query=newWP_Query(array(
'post_status' = > 'public',
'post_type' = > 'post', // Page type (e.g., page, post, custom post type)
'paged' = > $paged,
'posts_per_page' = > 10, // Views
'orderby' = > 'date',
'order' = > 'DESC'
) );
if($the_query->have_posts()):
while($the_query->have_posts())—$the_query->the_post();
?>
<?php//Show a list of blogs start?>
<?php if(have_posts()):while(have_posts()):the_post();?>
<article class="blog-list__list-item">
<a href="<?php the_permalink();?>"class="blog-item">
<?php//Show eye catch start?>
<div class="blog-item_thumbnail-second">
<?php if(has_post_thumbnail()):?>
<img class="blog-item_thumbnail-image-second" src="<?php the_post_thumbnail_url('large');?>">
<?php endif;?>
</div>
<?php//end?> to display eye catch
<div class="blog-item__content">
<?php//start to display title?>
<h3class="blog-item__title">?php the_title();?>/h3>
<?php//end?> to display the title
<?php//start to display excerpts?>
<h3class="blog-item__read"><?php the_excerpt();?>/h3>
<?php//end?> to display excerpts
<div class="blog-item__button">
<span class="blog-item__button-more">Read Articles</span>
</div>
</div>
</a>
</article>
<?php break;?>
<?php endwhile;?>
<?php while(have_posts()):the_post();?>
<article class="blog-list__list-item">
<a href="<?php the_permalink();?>"class="blog-item">
<?php//Show eye catch start?>
<div class="blog-item__thumbnail">
<?php if(has_post_thumbnail()):?>
<img class="blog-item_thumbnail-image" src="<?php the_post_thumbnail_url('large');?>">
<?php endif;?>
</div>
<?php//end?> to display eye catch
<div class="blog-item__content">
<?php//start to display title?>
<h3class="blog-item__title">?php the_title();?>/h3>
<?php//end?> to display the title
<?php//start to display excerpts?>
<h3class="blog-item__read"><?php the_excerpt();?>/h3>
<?php//end?> to display excerpts
<div class="blog-item__button">
<span class="blog-item__button-more">Read Articles</span>
</div>
</div>
</a>
</article>
<?php endwhile;?>
<?php endif;?>
<?php//View a list of blogs end?>
<?php break;?>
<?php
endwhile;
else:
echo'<div><p> none.</p></div>';
endif;
?>
</ul>
</div>
It's done now.
Re-use the code you picked up on a different net from the location,
<?php if(have_posts()):?>
<?php while(have_posts()):the_post();?>
<!--Layout of first post-->
<!--Show one and break through the loop-->
<?php break;?>
<?php endwhile;?>
<!--The loop should start with the second one-->
<?php while(have_posts()):the_post();?>
<!--Layout of second and subsequent posts-->
<?php endwhile;?>
<?php endif:?>
That's how it worked.
<?php break;?>
It is done by adding at the end to stop the loop.
Thank you all for your cooperation.
917 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
620 Uncaught (inpromise) Error on Electron: An object could not be cloned
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.