AJAX Returning Way Too Many Posts

OK, so I’m not sure if this is best practice, but after testing the code by using a onclick rather than scroll, the pages do load appropriately. I have got round the issue of loads of results by adding a condition to only return true after the AJAX has completed; // AJAX Posts var pageNumber=”0″; … Read more

Replace Underscore (_) on Space ( )

You are correct, you need to use str_replace. See details here So the correct code would be: $postData = array( ‘post_title’ => str_replace(‘_’, ‘ ‘, $attachment->post_title), ‘post_type’ => ‘post’, ‘post_content’ => $image_tag, ‘post_category’ => array(‘0’), ‘post_status’ => ‘publish’ );

How to detect and make links nofollow in author description

This is really more of a general PHP question, but this will do the trick: $author_desc=”<div class=”td-author-description”>”; $author_desc .= get_the_author_meta( ‘description’, $author_id ); $author_desc .= ‘</div>’; $dom = new DOMDocument; $dom->loadHTML( mb_convert_encoding( $author_desc, ‘HTML-ENTITIES’, ‘UTF-8’ ) ); $sxe = simplexml_import_dom( $dom ); // Process all <a> nodes with an href attribute foreach ( $sxe->xpath( ‘//a[@href]’ … Read more

Display 6 most recent post on homepage?

I have checked your code please compare your WP_Query args with mine. Also, have a look on the available WP_Query args. $queryArgs = array( // Do not get posts from the Uncategorized category. ‘cat’ => ‘-1’, // Order by date. ‘orderby’ => ‘date’, // Show all posts. ‘posts_per_page’ => ‘6’, ‘post_type’ => ‘portfolio’, ‘post_status’ => … Read more

wordpress ajax pagination

Is your “next” Button an HTML “a”-Element? Please add a little bit more of your code. How do you call your $.ajax – Method? Am I right that you call it sometings like this: $(“#elementid”).on(“click”, function() { $.ajax({….}); } When I am right and you use an a-Element. Add the following after the “click” method: … Read more