Use WP_Query for custom post type but result get empty

You can write like $args = array( ‘posts_per_page’ => 10, // -1 to fetch all posts ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘at-subscription’, // the post type ‘post_status’ => ‘publish’, ‘suppress_filters’ => true ); $posts_array = get_posts( $args ); // For displaying all posts related to at-subscription print_r( $posts_array ); Hope this will … Read more

soap request in wordpress for a fedex pickup request [closed]

It looks like it was my original assumption. I placed all my codes into functions and then made a plugin and everything is working almost perfectly. The major hurdle was that because it was being handled on 2 pages and outside functions wordpress just didn’t seem to know what it/I was doing. Thanks again @tomjnowell … Read more

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