First post in loop displays twice

The else of the $change % 5 == 0 also runs when $change is a 1 and that is why the first post is displayed twice. You could fix it by changing <?php $change++ ?> <?php endif; ?> <?php if ( $change % 5 == 0 ) : ?> to <?php $change++ ?> <?php elseif … Read more

How can we pass a value from the_permalink() at WordPress?

the_permalink() only displays the URL for the current post in the loop. If you want to link to another post, you can use echo get_the_permalink( 123 );, where 123 is a post ID. <a href=”https://wordpress.stackexchange.com/questions/353261/<?php echo get_the_permalink( 123 ) ?>”> Note that the_permalink() and get_the_permalink() only get URLs for posts. If you want to get … Read more

how to edit attachments?

Use the Media Uploader. Press Upload Photo above the editor. See the tab “Gallery( number-of-items-attacched )” Manage / Rerrange order To delete: show an item and press Delete (it’s at below of the window)

get value from post to sidebar

You did not explain your question well so I am guessing quite a bit but I think you want something like this: function post_ids_wpse() { global $wp_query; $ids = wp_list_pluck($wp_query->posts,’ID’); $scs=””; foreach ($ids as $id) { $scs .= “[wp_value id='{$id}’]”; } echo do_shortcode($scs); } That is very crude. You should check that the various values … Read more

Custom post page has attributes of latest post [closed]

I believe you are talking about the blog page, the page you set as posts page when you select a static front page. Many functionality like breadcrumbs relies on the $post global. By default, if nothing breaks the $post global, before the loop, the $post global should always hold the first post in the main … Read more