Help making my pagination plugin better

Ok, here are some pointers: never run any meaningful code right from plugin body (especially don’t start queuing jQuery everywhere like you do – that’s asking for trouble), always do it at appropriate hooks; learn how to use $default argument in get_option() will save you a lot of typing there; learn how to use plugins_url() … Read more

Plugin (or Theme) containing its own Plugins?

See Add multiple plugin directories for one way to do this. In an earlier project I did something similar, but I used a dedicated theme options page for my theme plugins. Looking back … I wouldn’t do that again. Plugin updates are a too complicated, separated version control setups too. The client wasn’t always sure … Read more

Upload specific images to specific folder

In your answer you said that desired path is something like wp-content\uploads\state-name\destination\ where state-name is a taxonomy term and destination is the slug of one destination CPT. Last thing is not clear from your question, but it seems so, let me know if I’m wrong). So, I suggest you this workflow: Add a destination post … Read more

Keep one user logged for a year?

get_currentuserinfo() is a pluggable function, it is not available during plugins load stage. That aside you shouldn’t be adding filter conditionally, but use data provided by the filter. If you take a look at filter calls: apply_filters( ‘auth_cookie_expiration’, 14 * DAY_IN_SECONDS, $user_id, $remember ) $user_id is provided as second argument. You just have your filter … Read more

wp_enqueue_scripts not working in custom theme

I have found this small error in my code which stops wp_enqueue_scripts() to work in my theme was I forget to put wp_head in my head section. For another person who may make same mistake are advised to check that they have include wp_head in head part and wp_foot at end of your theme.

Change Page’s Tag Using functions.php File

Check this out function custom_title($title_parts) { $title_parts[‘title’] = “Page Title”; return $title_parts; } add_filter( ‘document_title_parts’, ‘custom_title’ ); In custom_title, $title_parts contains ‘title’, ‘page’ (the pagination), ‘tagline’ (the slogan you specified) and ‘site’. Set “title” the way you like.

Add rewrite rule to permalink structure

1. Add a new rewrite rule: add_action(‘init’, function() { add_rewrite_rule(‘^dog/([^/]+)/?$’, ‘index.php?cat=dog&name=$matches[1]’, ‘top’); }, 10, 0); 2. Filter the post link: add_filter(‘post_link’, function($post_link, $post, $leave_name = false, $sample = false) { if ( is_object_in_term($post->ID, ‘category’, ‘DOG’) ) { $post_link = str_replace($post->ID . ‘-‘, ”, $post_link); } return $post_link; }, 10, 4); Try it in your functions.php. … Read more

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