Use the_content outside the loop

If you are trying to do it for the current page you are on you can just use this: global $post; $content = $post->post_content;` This will get the content for the current post instead of having to set the ID specifically.

Show scheduled posts in archive page

Keep things simple – leave your archive templates alone and place this in your functions.php; add_action( ‘pre_get_posts’, function ( $wp_query ) { global $wp_post_statuses; if ( ! empty( $wp_post_statuses[‘future’] ) && ! is_admin() && $wp_query->is_main_query() && ( $wp_query->is_date() || $wp_query->is_single() ) ) { $wp_post_statuses[‘future’]->public = true; } }); Essentially, it says; If we’re on a … Read more

How to find meta_values to call

On the post edit screen you can have the »Custom Fields« meta box, looking somewhat like shown here. You might have to enable it via the screen options. This way you can see the meta data for the edited post, but underscored meta data won’t be shown, because it is hidden. To make the hidden … Read more

Query date in wordpress loop

You want to query for posts with event_date in the future but you have saved (or so it seems from a comment), your dates as: date(“F”, $unixtime).” “.date(“d”, $unixtime).”, “.date(“Y”, $unixtime); That is “textual month name” + “numeric day” + “numeric year”. There is no way to query/sort that format so that it matches a … Read more

WordPress Alphabetical Glossary close div in loop

If you search the site, most of the “display nth post different” questions are very closely related to this one, and honestly this is more a PHP + logic question that a WordPress one. if (have_posts()) { $curr_letter=””; echo ‘<div class=”alphawrapper”>’; while (have_posts()) { the_post(); $title = get_the_title(); $title_array = explode(‘ ‘, $title); $second_word = … Read more

Identify the page being shown while in The Loop

I believe you want get_queried_object. That will return information about the page per se and not necessarily about the posts/pages being displayed in the Loop. Be aware that it returns very different information depending on the type of page you are one. It will return user information on an author archive, for example, but category … Read more

Two custom loops, pagination, offset

I can’t use only one Loop because of how complicated my markup is. Markup, no matter how complicated, should never ever be a valid basis when coming to deciding to run multiple loops. Multiple loops should only ever be used if there is absolutely no other means to achieve a certain result, and that is … Read more

Multiple posts with one loop iteration

Ultimately, this question is off-topic, because the solution has nothing to do with WordPress. Outputting posts in a grid pattern is an HTML/CSS issue, and the best-practice solutions don’t involve putting every three posts inside a separate containing <div>. Even so, you can do what you want to do, using PHP (which, technically speaking, still … Read more

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