How to create loop in custom page, and get id from url into this loop?

basically what you want to do is get the id from $_GET[‘id’] then you can use the WP_Query <?php wp_reset_postdata(); $args = array( ‘category’ => $_GET[‘id’], ‘order’ => ‘DESC’, ); $query = new WP_Query($args); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); //do your stuff here…………………. endwhile; endif; ?> here $_GET[‘id’] will … Read more

Why does it loop twice?

I agree with Takebo it’s problem with tag. <div class=”col-md-12 postbody “> <a href=”https://wordpress.stackexchange.com/questions/266597/<?php the_permalink(); ?>”><?php the_title(); ?> here is missing </a> `</div> <a class=”cta” href=”https://wordpress.stackexchange.com/questions/266597/<?php the_permalink(); ?>”>DÉCOUVRIR &#8594;</a> </div> </div>`

Show other category posts in single.php

List of post of a category can be show using wp_query like this $paged = get_query_var(‘paged’) ? get_query_var(‘paged’) : 1; $args = array( ‘post_type’ => ‘post’, //Specifying post type ‘posts_per_page’ => 10, //How many posts per page ‘cat’ =>’cat2′, //Specifying post category to show posts ‘paged’ => $paged //For pagingation (if required) ); $loop = … Read more

Return only one post format in index.php [duplicate]

I solved the problem. All I need to add is the following line of code query_posts( $args ); The result will be something like this: <div class=”content”> <?php if (have_posts()) : ?> <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $total_post_count = wp_count_posts(); $published_post_count = $total_post_count->publish; $total_pages = ceil( $published_post_count / $posts_per_page ); if ( … Read more

Show a list of user posts in the user admin page

You can use edit_user_profile (when viewing other user profiles) and show_user_profile (when viewing your own profile) actions to add information on profile page. So to have there the list of posts of the selected user you could add to your functions.php: function show_user_posts_on_profile( $user ) { $args = array( ‘author’ => $user->ID ); $user_posts = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)