I have code for custom post type, for custom taxonomy for displaying category posts. I am using Advanced Custom Fields What I want is to order posts by custom field value, and I was wondering how I can do it? For example if posts have custom field called “rating” how can I order posts from lowest value to highest? Here's an example code <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'brendovi' ) ); ?> <?php if (have_posts()): query_posts($query_string.'&posts_per_page=-1&orderby=date&order=ASC'); ?> <?php while( have_posts() ) : the_post(); ?> This is the code that works just fine for displaying most recent custom post type posts, and they have custom fields called field_1, field_2, field_3. And users will fill those fields with numeric value. And later on on single post, I'll do the calculation summing those values and dividing by 3 to get avg value. Let's call it field_4. I am stuck at displaying posts and … [Read more...] about Query string order by custom field
Exec query string sql server
We have are building a WordPress site on our intranet site and wish to connect it to a Microsoft SQL Server. I have downloaded and configured PHP and PHP Manager on IIS. I have also downloaded SQL Server DLL from the list of answered questions that popped on as I was typing the title of this thread. I downloaded those DLLs inside the PHP folder as instructed. When I fired up the server address to install WordPress, I was prompted to provide SQL DB name, username, password and DB hostname. I have also downloaded wp-db-Abstraction plugin, put the wp-db-abstraction.php file into the folder where the WordPress files are saved, put the wp-db-abstraction folder into wp_content as instructed by the online article I was reading. Inside this folder, there is a db.php file. I also copied this db.php file into foldername where the rest of the downloaded WordPress files reside. When I clicked to continue, I got the following error messages: Warning: mysqli_real_connect(): (HY000/2002): No … [Read more...] about How do I configure WordPress to talk to a Microsoft SQL Server database?
I am trying to redirect a default WP login form, if it's HTTP referer contains some specific query string parameter. Scenario: I need to redirect new users (the ones who just created their passwords using the link in their e-mail) to my custom login form, once the password is generated. The steps in WP password creation go like this: /wp-login.php?action=rp (this is the link you get in your e-mail, you type your new password there) /wp-login.php?action=resetpass (this is the screen where it says your password was saved and you can login) /wp-login.php (once the password is created, there is no query parameter anymore) I am able to redirect it when the action=resetpass argument is present, but that way the password won't get generated and my custom form thows "wrong password" error. My thinking is: I should be able to redirect the wp-login.php page if it's HTTP referer contained action=resetpass argument, that way it would fit my needs just fine. Here's my code: <?php … [Read more...] about Redirect a login form, if referer contains URL query string parameter
”Remove query strings from static resources” a common statement which you find while checking the loading time of your site in GTmetrix or any other related tool. We all know that Google is now using page speed to rank pages in their search results, so you must have a closer look at the all the aspects which are slowing down your site. You can use Google Page Speed, Pingdom Tool or GTmetrix to find out the parameters which are affecting the speed of your site and take action to rectify those issues. Today in this post, we will take remove query strings from static resources a very common parameter which affects loading speed of a site. You can’t cache a link with a “?” in its URL. The query string is a method used by developers of WordPress tools to pass the content values or to carry the version detail. Remove query strings from static resources Now, the question is how to remove query strings from static resources to make sure that it is not affecting … [Read more...] about How to Remove Query Strings From Static Resources