How to remove Query String "?" (question mark) from URL (Using Wordpress) - wordpress

I was using wordpress 3.3 to power my website. I tested it with Page Speed and it gave me error "remove query string from URL).... The query string is a question mark which appears in the start of query paramter of the url.....
http://gizmocube.com/images/logo.png .... is outputted as ...
http://gizmocube.com/images/logo.png?9d7bd4
how do i get rid of this question mark.... any .htacess stuff... any help would be appreciated....

Do you have W3 Total Cache Installed ? (Wordpress Plugin) , If you do
Go to the Browser Cache Tab
Untick
Prevent caching of objects after settings change
Whenever settings are changed, a new query string will be generated and appended to objects allowing the new policy to be applied.
Clear the Cache then It's gone :)
Hope this helps
--
Source
Myself (Having the same issue myself )

Go to the Browser Cache Tab > untick "Prevent caching of objects after settings change".
This will slove the issue.

Change your Permalink settings from the default with question marks to a format you prefer under /wp-admin/options-permalink.php
Default: http://www.example.com/?p=123
Day and name: http://www.example.com/2012/03/02/sample-post/
Month and name: http://www.example.com/2012/03/sample-post/
Numeric: http://www.example.com/archives/123
Post name: http://www.example.com/sample-post/
Custom Structure: /%year%/%monthnum%/%postname%/

Add this code to your functions.php file, it works for my sites.
function _remove_script_version( $src ){
$parts = explode( '?ver', $src );
return $parts[0];
}
add_filter('script_loader_src','_remove_script_version', 15, 1 );
add_filter('style_loader_src','_remove_script_version', 15, 1 );

Related

Extract and Echo a URL parameter in wordpress using Avada theme

On the WordPress site using Avada, My situation is very much similar to
https://stackoverflow.com/a/40250428/12323081
They have given the code to be added into functions.php, As per my understanding the code should go in the child theme of Avada, but I don't understand where this part of the code will go?
(Which template file should this code be added to?)
Once this is done, you can query for these variables in your template:
if ( get_query_var('firstName') ) {
echo get_query_var('firstName');
}
if ( get_query_var('lastName') ) {
echo get_query_var('lastName');
}
Once added, how can these parameters be called on Front End?
Any help will be highly appreciated.
After doing quite some R&D, there seems to be a very simple solution to get parameters from the URL in WP/Avada.
In order to achieve the result in my question, please use the Title element and then make use of the dynamic field 'Request Parameter' -> Param Type - Get -> Query Var - firstName
The image is attached for reference.
tinyurl.com/yy3vtwxq

WordPress upload file

I would like to upload a file like as (.apk) but I can't. I receive this message.
Sorry, this file type is not allowed for security reasons.
I show solutions as to settings on multisite, but I don't have this choice on my version. In which way I could enable the settings of multisite?
Is there any way to upload files like apk,( may a plugin)?
Thank you in advance!
Open your functions.php file and add the following code inside it.
add_filter('upload_mimes', 'allow_custom_mimes');
function allow_custom_mimes ( $existing_mimes = array() ) {
// with mime type ‘application/vnd.android.package-archive
$existing_mimes['apk'] = 'application/vnd.android.package-archive';
return $existing_mimes;
}
Restart your server after adding code and check.

Buddy Press sort by last name?

I’ve been trying to get a Members Directory to sort by last name, but have had no luck. Any help would be much appreciated.
The directory is here: http://109.199.101.20/~newfeldenkrais/practitioner-search/results/
The search is powered by the plugin BP Profile Search, but is displaying on the default members page.
Versions:
WP – Version 4.7.5
BP – Version 2.8.2
BP Profile Search – Version 4.7.6
I’ve tried various solutions that I was able to find on Google with no luck, the most recent solution I could find was here: https://buddypress.org/support/topic/custom-searchfilter-based-on-custom-field/
It looks like that solution is looking for the space between the First Name and Last Name to target the last name, but BuddyPress seems to be grabbing the “nicename”, which has no space. So, it isn’t able to target the space for me?
Use this hook in functions.php,
public function alphabetize_by_last_name( $bp_user_query ) {
if ( 'alphabetical' == $bp_user_query->query_vars['type'] )
$bp_user_query->uid_clauses['orderby'] = "ORDER BY substring_index(u.display_name, ' ', -1)";
}
add_action ( 'bp_pre_user_query', 'alphabetize_by_last_name' );
Ref : https://gist.github.com/mgmartel/4463855
https://buddypress.org/support/topic/sort-user-list-by-last-name/

Network admin "Sites" page - Wordpress

I'm running a Wordpress multisite network, to manage the sites on the network I go to the "sites"page which displays the following headings:
URL - Last Updated - Registered - Users
To make this more useful I'd like to add the name of the site to this table. I have now added a column through using this code:
add_filter('wpmu_blogs_columns', 'add_site_name_column');
function add_site_name_column($site_columns) {
$site_columns['site_name'] = 'Site Name';
return $site_columns;
}
However I cant now work out how to put the site name into the column?
Check in the file wp-admin/includes/class-wp-ms-site-list-table.php, specifically look for the get_columns method.
The key to doing this will be for you to add a filter that works with the columns:
add_filter( 'wpmu_blogs_columns', 'my_custom_blog_columns' );
function my_custom_blog_columns( $sites_columns ) {
// Modify $site_columns here....
return $site_columns;
}
Typically you would add this filter in your theme's functions.php file, or in the plugin file(s) you are developing.

How to change members per page in BuddyPress members directory

In BuddyPress, it shows 20 members per members directory page. I want to list 24 members per page with a pagination and sorting must work perfectly. I tried:
bp_has_members(bp_ajax_querystring('members').'per_page=24'))
It works but pagination and sorting are not working correctly.
For those like me wondering how to do this nowadays and ending here after searching with their fav engine, the proper way is to use a filter in bp-custom.php or the functions.php of your theme.
Cf. https://codex.buddypress.org/developer/using-bp_parse_args-to-filter-buddypress-template-loops/
For the member loop it would be something like :
function my_bp_members_per_page( $retval ) {
$retval['per_page'] = 24;
return $retval;
}
add_filter( 'bp_after_has_members_parse_args', 'my_bp_members_per_page' );
Bonus : this will still work if you use cache like WP Rocket.
Former method doesn't work with cache and logged in user.
You need an '&' for each additional argument.
Try:
bp_has_members(bp_ajax_querystring('members').'&per_page=24'))
To modify this file, you make a copy of it and put it into your child-theme
/your-child-theme/buddypress/members/members-loop.php

Resources