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

Permalink of some posts change

Are your rewrite rules wrapped in <IfModule> tags? Should look like this: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress

WordPress rewrite url help needed

You can edit the permalink properties in www.url.com/wp-admin/options-permalink.php, without editing your .htaccess file. You can choose the last option and add there the “city name” you need.

How to show main category related to that post

There are better suited functions to do what you want available. In reference to your other, similar question, use get_the_category() like you did there. Or you can use get_categories() or wp_list_categories(). What to chose depends on your needs, for example in regards to formatting. Btw, the question, what the main category is isn’t as easy … Read more

Authentication over CURL

I figured out the answer myself and I’ll post it here in case anyone else has this problem. Basically in WP 3.9.1, wp_insert_post() checks the current logged in user for account capabilities (at least this is what I assume). Since I was connecting over cURL, there is no logged in user so the capability checks … Read more