Jquery and Sticky

First, please use wp_enqueue_script() to add JavaScript to your WordPress pages. Also note that jQuery is loaded by default in WordPress; there’s no need for you to do it. From that same page: The jQuery library included with WordPress is set to the noConflict() mode (see wp-includes/js/jquery/jquery.js). This is to prevent compatibility problems with other … Read more

How to get the parameters on page and avoid 404?

The conjunction of add_rewrite_rule() & add_rewrite_tag() is a little bit tricky, perhaps you could use parse_url hook what came useful for me. The code below is to catch multiple paramete=value separated with slash. Code – add_filter( ‘parse_request’, ‘wpse128790_parse_request’ ); function wpse128790_parse_request( $wp ) { $pageslug = ‘mypage’; if( isset($wp->request) && strpos($wp->request, “https://wordpress.stackexchange.com/”) ) { $requests … Read more

Post Thumbnail on Single (if elseif else)

I tried to refactor the code in a preferred way, that’s all. Logically, it seems to work. What I did is: I preferred WP_Query() for such custom query, because experienced WordPress enthusiasts like it that way (We can learn more) I changed the hard-coding into WordPress way to get the theme directory, using get_template_directory_uri() And … Read more

Ger posts from similar tags and categories

Below is the solution for your problem If my understanding is right! if ($tags) { $tag_ids = array(); foreach($tags as $single_tag) $tag_ids[] = $single_tag->term_id; $args=array( ‘tag__in’ => $tag_ids, ‘post__not_in’ => array($post->ID), ‘showposts’=> 5, ); if( count($args) < 5 ) { $n = 5 – count($args); //to get posts based on the category if ($categories) { … Read more

mysql update user’s password and activation key

You are using the user email as the user login. Your code, formatted for readability, looks like: $resetQuery = $wpdb -> query( $wpdb -> prepare( “UPDATE wp_users SET user_pass = %s, user_activation_key = ” WHERE user_login = %s AND user_activation_key = %s”, $hashedPwd, $useremail, $key ) ); The $useremail argument matches the user_login = %s … Read more