jaroat
Forum Replies Created
-
Forum: Plugins
In reply to: [WP API Menus] Notice when wp_debug activatedSomething like this should do it:
switch ( $item[ 'type' ] ) { case 'post_type': $post = get_post( $item['object_id'] ); $menu_item = array( 'id' => abs( $item['ID'] ), 'order' => (int) $item['menu_order'], 'parent' => abs( $item['menu_item_parent'] ), 'title' => $item['title'], 'url' => $item['url'], 'attr' => $item['attr_title'], 'target' => $item['target'], 'classes' => implode( ' ', $item['classes'] ), 'xfn' => $item['xfn'], 'description' => $item['description'], 'object_id' => abs( $item['object_id'] ), 'object' => $item['object'], 'object_slug' => $post !== null ? $post->post_name : '', 'type' => $item['type'], 'type_label' => $item['type_label'], ); break; default: $menu_item = array( 'id' => abs( $item['ID'] ), 'order' => (int) $item['menu_order'], 'parent' => abs( $item['menu_item_parent'] ), 'title' => $item['title'], 'url' => $item['url'], 'attr' => $item['attr_title'], 'target' => $item['target'], 'classes' => implode( ' ', $item['classes'] ), 'xfn' => $item['xfn'], 'description' => $item['description'], 'object_id' => abs( $item['object_id'] ), 'object' => $item['object'], 'object_slug' => null, 'type' => $item['type'], 'type_label' => $item['type_label'], ); break; }
- This reply was modified 4 years, 5 months ago by jaroat.
Forum: Plugins
In reply to: [WP API Menus] Notice when wp_debug activatedHi –
Seems to be a problem if a nav menu item doesn’t refer to a wp_posts entry.
In my case, the menu item was linked to a category (resulting in a link to the category overview page) so the object_id doesn’t refer to a wp_posts row but on a wp_term instead. get_post fails in that case and returns null.
A possible solution would be to extend the format_menu_item function a little bit so it differentiates between the possible menu-item-types (taxonomy, custom, post_type, etc.).
Best from Salzburg!
– Johannes
Forum: Plugins
In reply to: [Loco Translate] Retrieve translatable strings from Gutenberg blocks?Hi Tim –
Any news on Gutenberg compatibility? We’re implementing some Gutenberg blocks right now and Loco Translate would be a big helper …
best from Salzburg!
– Johannes
I reported the issue to the ACF people: i’m using acf pro on a customer website.
Same problem: did anyone report that to the acf people?
Ah nope – unfortunately doesn’t work either: If calling the media library without post_id, uploaded files there don’t get set the correct parent_id.
Could you please hand over the post_id when calling it?
Many thanks in advance
and best regards from Salzburg, Austria.– Johannes
Forum: Plugins
In reply to: [WP Super Cache] Additional action in wp_cron_preload_cache possible?Thanks for your feedback!
I ended up writing a preloading caching plugin custom tailored to the customer.
I found a rather ugly solution: By modifying the wp_query for the wp media selector (pre_get_posts).
Unfortunately, Elementor doesn’t hand over the post id when calling the wp attachment selector (get variable post_id contains 0), so i’m fetching it via the http referer, which is not very reliable.
This solution may not work in every browser:
add_action('pre_get_posts', function($query) { global $pagenow; if ('admin-ajax.php' != $pagenow) { return; } if ($_REQUEST['action'] != 'query-attachments') { return; } // Elementor doesn't provide the post_id when calling // the wp media selector: We have to try to get it // via the http referer (ugly). Additionally we // prevent the code to be executed in other locations. $referer = $_SERVER['HTTP_REFERER']; if (strpos($referer, 'elementor') === false) { return; } preg_match('/post=([0-9]+)/i', $referer, $matches); $post_id = $matches[1]; // Set the filter $query->set('post_parent', $post_id); return; });
Forum: Plugins
In reply to: [Yet Another Photoblog] PHP7 compatibilityFixed.
Forum: Fixing WordPress
In reply to: Can't update WordPress – SSL certificate problem – error:14090086:SSame here: 11 WP 4.1.1-Sites on a customers server – All complaining about “SSL certificate problem: unable to get local issuer certificate”.
Works after overwriting wp-includes/certificates/ca-bundle.crt with version mentioned in https://myonlinesecurity.co.uk/wordpress-4-4-update-breaks-itself-with-ssl-certificate-problem-unable-to-get-local-issuer-certificate/
But that’s no durable solution since that file gets overwritten during every WP Update.
Btw: the server has open ssl 0.9.8e – so the e version isn’t a solution either.
br from Salzburg, Austria
Forum: Plugins
In reply to: [WooCommerce EU VAT Assistant] Wrong VAT on shipping costs and invoiceHi Diego –
Sorry for the late response –
and thanks for your competent feedback!After digging deeper into the sources i identified “Woocommerce German Market” to be the problem. Seems that commercial plugin doesn’t play well with other plugins (unfortunately, this is the second time i discovered that).
Switched to “Woocommerce germanized” – That extension doesn’t cost anything and actually plays very well with your solution.
Sorry for the hazzle and …
Many thanks for your plugin!BR from Salzburg, Austria,
– Johannes
Forum: Plugins
In reply to: [XML Sitemap Generator for Google] One Sitemap from several multisitesHi –
A generic solution for that would be the following code inserted in the functions.php of the theme of your baseblog (you may also insert the code in a plugin activated there):
<?php // Add Subblog sitemap.xml files add_action('sm_build_index', function($gsg) { $blogs = get_blog_list(); if (!empty($blogs)) { foreach ($blogs as $blog) { if ($blog['blog_id'] != get_current_blog_id()) { switch_to_blog($blog['blog_id']); $sitemap = new GoogleSitemapGeneratorSitemapEntry( 'https://' . $blog['domain'] . $blog['path'] . 'sitemap.xml', strtotime(get_lastpostmodified('gmt')) ); $gsg->AddElement($sitemap); restore_current_blog(); } } } }); do_action("sm_rebuild");
if you’re still using PHP < 5.3 you would have to modify the code slightly (anonymous functions: https://php.net/manual/de/functions.anonymous.php).
The plugin offers some action hooks so you can insert your additional content into the generated sitemaps.
one note: the sm_rebuild should only be triggered if something has changed.
br from Salzburg,
– Johannes
Forum: Plugins
In reply to: [Yet Another Photoblog] Exif code simplification11 Months later … i’ll take a look since i’m planing an update.
The exif tag names change after switching to exif_read_data?
That would be some major issue for all sites already using exif output.
But a leaner code base with fewer dependencies is a better codebase.
For all of you seeking a way out of YAPB i just programmed a migration plugin to be found via
https://johannes.jarolim.com/blog/wp-content/uploads/2006/08/yet-another-photoblog-migrator.zip
I’m sorry to see you go but understand that the WordPress Media Management has grown up since 2006 – the start date of YAPB.
The plugin converts all your YAPB images into standard WordPress attachments – you may even set them all as post thumbnails if your theme supports that feature.
Just upload the plugin into your wp-content/plugins directory, go into your admin panel and activate the plugin. After that, click on “tools/YAPB Migration” and start the migration.
So: Thanks for the support over the years and wish you all the best:
br from good ‘ol Salzburg!Have a look at the next post