get_the_content not working in loop?

echo $post->post_content; will echo your post content. Keep in mind though, it’s raw out of the database (same as get_the_content()). If you want to apply the same filters that the_content() receives, follow the instructions in the codex: <?php $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, ‘]]>’, $content); ?>

Pagination adding extra posts only on page 2

Here’s a suggestion for a general way to support different number of posts on the home page than on the other paginated pages. We should use the main query instead of sub-queries, if possible. Formula It seems to make sense to take the offset for paginated pages as: offset_op = ( paged – 1 ) … Read more

loop not showing up when using a custom page template

You haven’t created a query to return your post index results. Let me back up… In WordPress something called the “Main” query runs very early in the page load, and well before your template files load. That query retrieves the posts to display and also (more or less) determines which template file to use to … Read more

Displaying child page content of a certain parent

This is a near duplicate of a number of questions here, but the “single random result” might make it somewhat distinct. $args = array( ‘post_type’ => ‘page’, ‘post_parent’ => $post->ID, ‘orderby’ => ‘rand’, ‘posts_per_page’ => 1, ‘no_found_rows’ => true ); $child = new WP_Query($args); var_dump($child->posts); You are telling WP_Query to pick 1) pages, 2) with … Read more

pop-up lighbox with AJAX

To use AJAX in a WordPress website you can the admin-ajax.php file. This file handles your requests and sends it to the correct function. A short step-by-step guide on how to achieve: First you need to localize your javascript file so that it knows the URL of the admin-ajax.php file on your server. add_action( ‘wp_enqueue_scripts’, … Read more

include(locate_template) messing up the loop

I found the problem here. It was with the $this_page variable, it was referencing the homepage still and kept the about page from working. I had to simply modify how it was pulling the page ID and storing it. Here’s my amended code. <?php /* Template Name: Page- Home */ get_header(); ?> <?php $this_page=get_the_ID(); $loop … Read more

Post Loop not Returning Permalink

You have made the mistake in getting the post link in your code. Missing <?php global $post; ?> – Initialization at the start of the loop After setting up the post data your query becomes like normal Wp_Query so that you can get the permalink() in normal method itself using the_permalink() instead of get_permalink($post->id). Since … Read more

wp_insert_posts Fatal error: Maximum function nesting level of ‘100’ reached, aborting!

Fixed the problem I’ve added this line before the insertion of the posts. remove_action(‘save_post’, __FUNCTION__); final code: add_action(‘save_post’, ‘save_post_func’); function save_post_func(){ remove_action(‘save_post’, __FUNCTION__); include_once(ABSPATH . WPINC . ‘/feed.php’); $rss = fetch_feed($url); if (!is_wp_error($rss)) { $maxitems = $rss->get_item_quantity(5); $rss_items = $rss->get_items(0, $maxitems); foreach ($rss_items as $item) { wp_insert_post(array(‘post_title’ => ‘a’)); } } }

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