sjoerd72
Forum Replies Created
-
Forum: Plugins
In reply to: [WP GPX Maps] Is it possible to hide the elevation hint?Hi,
There seems to be a couple of bugs in this plugin that’s preventing me from updating (and one of them is that the support for maptoolkit got removed (and i don’t even want to mention the satellite-view but alright – still a very good plugin.
1) Missing track when a gpx got multiple tracks.
One nasty bug that I mentioned a couple times but does not seems to be picked up by the authors is that when a gpx got multiple track, one of them is not show. This is a very simple bug to file:
Change line 21 of ./js/WP-GPX-Maps.js formfor ( i = 0; i < _len; i++ ) {
to
for ( i = 0; i <= _len; i++ ) {
This is a very simple fix.
2) Saving unchecked ‘show elevation’ this shows as checked.
For this bug I had to dive in to the code bit deeper and see what was going on. Since I do not have too much experience with plugins I used ‘show speed’ as a reference since that is working fine as far as I know.
First I started with how the admin-page was saving the option. On about line 523 of ./wp-gpx-maps-admin-settings.php the way the “show elevation” checkbox is being saved is a bit weird and does not use the same method as how “show speed” is save so I altered that to make it more consitent. This is the code for the table-cell starting at line 523:<td> <input name="wpgpxmaps_show_elevation" type="checkbox" value="true" <?php if ( true == $showEle ) { echo( 'checked' ); } ?> onchange="this.value = (this.checked)" /> <i><?php esc_html_e( 'Show altitude', 'wp-gpx-maps' ); ?></i> </td>
Then is still isn’t working properly. I was debugging the main file (./wp-gpx-maps.php) because I wanted to know what got returned from line 261:
$showEle = wpgpxmaps_findValue( $attr, 'showele', 'wpgpxmaps_show_elevation', true );
It seems when show elevation is enabled it return “true” but when it is disabled it returns “1”. Therefore I changed line 261 of ./wp-gpx-maps.php into this:
$showEle = wpgpxmaps_findValue( $attr, 'showele', 'wpgpxmaps_show_elevation', false );
I did some tests with these and it does work I think – When you add the option showele=”true” in the shortcode it also works when it is set disabled on the admin-page.
How this helps.
Regards
Sjoerd (k1600gt.nl)It seems the new version needs an extra php module (bcmath). Just install it and you are fine.
If you are on Ubuntu or similar :
Try following:sudo apt install php7.4-bcmath
You can replace 7.x with your versions of php:
php -version
will tell you moreafter you successfully installed it:
sudo systemctl restart apache2
Forum: Fixing WordPress
In reply to: Add options to theme-customizer in child-theme@joyously I can manage this in the code. That is not the issue. I got that working too, but I would like to make it more user friendly and place the option in a customizer.
$featured_image_on_first_page_only is 0 or 1, could be boolean. Not important right now.if ( ( $featured_image_on_first_page_only == 1 && $page == 1 ) || $featured_image_on_first_page_only == 0 ) { // featured image on 1st page or not or show anyways }
Also – I was not aware about the is_paged(). Nice to know.
@bcworkz Thank you for providing the link. I will look into it. I hope it becomes clear. The reason I’m doing a child-theme is that the theme I’m using is a commercial theme and want to extend it without tempering with the original due to updates. Also, I like to learn more about WP.
Don’t understand you on your last paragraph. I only asked one question which reflects the title.
Regards
SjoerdForum: Fixing WordPress
In reply to: Theme customizer blocked by browersI’m using let’s encrypt and there is nothing with that, but last night I was overthinking the problem and figured it had to be something I did in the apache2 configs and I was right.
In de main config I added some globals:
Header set X-Frame-Options: "ALLOW-FROM https://boxer.gs/" Header set Content-Security-Policy: "frame-ancestors https://boxer.gs/"
So there you have it. If I change those to https://k1600gt.nl/, it should be working again. Spend yesterday all day to figure it out and all I need was a good night’s sleep. Maybe I should move to settings to the site-config but will check that later.
Forum: Developing with WordPress
In reply to: How to get current page number in a multipage postHello Joy,
Oke – I never thought it would be this simple.
Thank you.
Regards,
Sjoerd.