How to assign value to a variable in the loop?

I have a WordPress loop:

while ( $query->have_posts() ) : $query->the_post();
    echo'<h3><a href="index.php?page_id=100">';the_title(); echo'</a></h3>';
    echo'<h4>'.the_excerpt().'</h4>

How can I assign post id value to a variable in this loop?

Read More

$id = the_id(); don’t work.

Related posts

Leave a Reply

1 comment