Fixing my display pending posts

You are currently having 2 loops, while you only need one. Something like this should work: <ul> <?php $args = array( ‘post_status’ => ‘pending’); $recent_posts = wp_get_recent_posts ( $args ); foreach( $recent_posts as $recent ){ echo ‘<li><a href=”‘ . get_permalink( $recent[“ID”] ) . ‘” title=”‘ . esc_attr( $recent[“post_title”] ) . ‘”>’; echo get_the_post_thumbnail($recent[“ID”], ‘thumbnail’); echo … Read more

Voting System, database connections?

What you want are post meta/custom fields, using these functions: get_post_meta add_post_meta update_post_meta Adding a new column to the posts table will only cause further issues down the line e.g.: database schema changes in WP Core destroying your extra column having to write your own custom SQL for everything related to post votes No help … Read more

Add wp-link-pages to post

I am answering my own question. Here is the javascript that I wrote which works 100% smooth. <script> $(document).on(“scroll mousedown DOMMouseScroll mousewheel keydown”, function (e) { if (e.which > 0 || e.type === “mousedown” || e.type === “mousewheel”) { $(‘html,body’).stop(); } }); pageSize = 1; showPage = function(page) { $(“.comix”).hide(); $(“.comix”).each(function(n) { if (n >= … Read more

Same sidebar in all posts as in the category

Retrieving category post is assigned to is rather straightforward with get_the_category(). However note that post can be easily placed into multiple categories and you will need some (quite elaborate) logic if you want to apply any particular sorting logic to it. From looking at your code however it’s not clear how exactly category/post/sidebar are tied … Read more

3rd Party Login in wordpress

Here is some code which i use to login between two site one is in wordpress and one is non-wordpress. I send an ajax request to wordpress site having email and password as data. After get this data on wordpress site i user wp_signon function to login the user. Here is the code. function sign_in_action() … Read more

Extra field in wp_post instead of postmeta

This is extremely broad question. Query performance depends on what you are querying and how efficiently MySQL server can perform that, using indexes available. You can have wildly inefficient query on one table, just like you can have perfectly fast one against meta. In general WP development the typical practices go (in popularity descending): Making … Read more

Removing a post from the results of a WP Query

Do you know the ID of the posts? Have you passed post__not_in as part of your query? $query = new WP_Query( array( ‘post_type’ => ‘post’, ‘post__not_in’ => array( 2, 5, 12, 14, 20 ) ) ); From: http://codex.wordpress.org/Class_Reference/WP_Query. The above will return all posts but exclude the IDs specified. Or do you have another way … Read more

Have latest post and recent posts display differently

You need 2 queries e.g. $query1 = new WP_Query( ‘post_type=post&posts_per_page=1’ ); // The Loop while ( $query1->have_posts() ) { $query1->the_post(); echo ‘<li>’ . get_the_title() . ‘</li>’; } wp_reset_postdata(); $query2 = new WP_Query( ‘post_type=post&posts_per_page=100&offset=1’ ); while( $query2->have_posts() ) { $query2->next_post(); echo ‘<li>’ . get_the_title( $query2->post->ID ) . ‘</li>’; } wp_reset_postdata(); The first query gets the first … Read more