Must permalinks always point to single post pages?

There are two hooks named ‘pre_post_link’ and ‘post_link’. Their first argument – which you can change – is the permalink. So … add_filter( ‘pre_post_link’, ‘wpse_42406_change_permalink’, 10, 2 ); function wpse_42406_change_permalink( $permalink, $post ) { // change the permalink, let it point to an archive etc. return $permalink; } … will change the output. In your … Read more

Keep a fluid max number of posts on site

Here is an idea but before we go into details, here are VERY VERY IMPORTANT notes NOTE: READ THIS FIRST Take a database back up before running this code. It is advisable to run this on a local install first for testing purposes. Note on wp_trash_post(), from the codex If trash is disabled, the post … Read more

How to wrap every image in a post with a div?

By default images already have unique class’s but this depends on your theme. Use firebug and hover over the images and you should see stuff like class=”aligncenter size-full wp-image-1525″. If you want to change the class or id or alter any attributes of the image you can use the get_image_tag filter. For example, add_filter(‘get_image_tag_class’,’my_custom_class’); function … Read more

Query only Posts from Both of Two Category?

Just guessing here, but I suspect that query_posts() is not appropriate in this situation. query_posts() should only be used to modify the main query, and the emerging best practice is that query_posts() shouldn’t be used at all, but, instead, replaced by filtering pre_get_posts. Having said all that, I would look into WP_Query and particularly the … Read more

Add a special filter link to All Posts in admin

First of all in your image you can see that WordPress lets you filter the posts by category, just bellow the what you have added to the image, But if you want to know how you can add your own link to the filter you can use the views_edit-post filter hook ex: add_action(‘pre_get_posts’, ‘query_add_filter’ ); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)