Tag Info

New answers tagged


previous_posts_link and next_posts_link are for archive page pagination, they both check if is_single is not true, so will not work on any sort of single post, page, or custom post type. use paginate_links instead or just manually build your pagination links.


More complex way I use it this way (I'm usually doing one page design, however the method of loading pages is still same). Fo Theme options, I'm using Option tree plugin where my clients could just checkbox which pages should appear there (it's passed by it's ID) and than I load it into the script. <?php // loading pages which should appear by option ...


You overwrite the value of $post when you output the first set of posts, so it's no longer the same post object as your single post. You can either wp_reset_postdata() after each loop (which you should do after the last one anyway), or assign $post->ID to some other var before the loop, and reference that instead so it doesn't get overwritten.


As stated in comments Most probably your posts per page setting for your site is less than 10 One have to remember, get_posts uses WP_Query. Any new instance of WP_Query and the main query (which also uses WP_Query) uses the value set for Blog pages show at most as default for the posts_per_page parameter when this parameter is not explicitly set by ...


ok, I fixed (with the help of everybody, from Reddit, and StackExchange), I had several issues. This is my working code: $args = array( 'numberposts' => 1, 'post_type' => 'my-cpt', 'order' => 'ASC' , 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'end_date', 'value' ...


Your issue is not with storage, it is with retrieval. get_post_custom() is inconvenient and rarely used in practice. get_post_meta() is more common in practice. Note it has explicit argument to retrieve a single value, rather than array of values for a key (which WP can do too).


THe only possible way is this if your html input name is name="end_date[]"... SO can you please check it once more


Try This : <!-- Category Archive Start --> <ul class="catArchive"> <?php $catQuery = $wpdb->get_results("SELECT * FROM $wpdb->terms AS wterms INNER JOIN $wpdb->term_taxonomy AS wtaxonomy ON ( wterms.term_id = wtaxonomy.term_id ) WHERE wtaxonomy.taxonomy = 'category' AND wtaxonomy.parent = 0 AND wtaxonomy.count > 0"); ...


slug is not a valid query paramter, so get_posts() will just return X latest posts! Use name instead. http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters

Top 50 recent answers are included