mkdgs
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Change locale inside ajax callHave you tried to not call load_plugin_textdomain() at plugin init when it’s an ajax request ?
( And call it into mbd_invoice_create_pdf() )
- This reply was modified 9 years, 3 months ago by mkdgs.
Forum: Developing with WordPress
In reply to: Change locale inside ajax callWhen i take look to the code of load_plugin_textdomain()
I see:
$locale = apply_filters( 'plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain ); $mofile = $domain . '-' . $locale . '.mo';So use filter ‘plugin_locale’ before load_plugin_textdomain() and removing it after may do the trick.
Forum: Developing with WordPress
In reply to: custom template not show on PreviewThanks @karpstrucking,
It’s convenient for my own use but a little bit hard to explain to other.
I want to get it work, i can fix it, but i don’t want recoding the wheel 🙂Forum: Developing with WordPress
In reply to: Change locale inside ajax callIt’s probably more easy to set the filter like you do, and removing it after when the pdf is created.
Forum: Developing with WordPress
In reply to: advice FOR plugin tabsWith your theme i don’t know, but may be with some line of CSS.
Like that http://htmldog.com/techniques/tabs/Forum: Developing with WordPress
In reply to: connect users to Custom post typesThis plugin can be a part of your solution:
https://ww.wp.xz.cn/plugins/posts-to-posts/It’s not a plugins for end user, but more a library for building advanced things.
Forum: Developing with WordPress
In reply to: advice FOR plugin tabsIf i need to create something like that i create a menu and stylized like a tab.
I think to try something ugly like:
in /my_themes/function.php
if (isset($_POST['wp-preview']) && $_POST['wp-preview'] == 'dopreview') { // filter and serialise my meta foreach ( $_POST['meta'] as $k => $v ) { if( $k === 'my_meta') { $_POST['meta'][$k] = json_encode($v); } } }And serialize in json only if it’s not already a string in my save_post filter.
Unfortunaly ‘wp_creating_autosave’ is triggered few line after normalize_whitespace().
// Store one autosave per author. If there is already an autosave, overwrite it. if ( $old_autosave = wp_get_post_autosave( $post_id, $post_author ) ) { $new_autosave = _wp_post_revision_data( $post_data, true ); $new_autosave['ID'] = $old_autosave->ID; $new_autosave['post_author'] = $post_author; // If the new autosave has the same content as the post, delete the autosave. $post = get_post( $post_id ); $autosave_is_different = false; foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) { if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) { $autosave_is_different = true; break; } } if ( ! $autosave_is_different ) { wp_delete_post_revision( $old_autosave->ID ); return 0; } /** * Fires before an autosave is stored. * * @since 4.1.0 * * @param array $new_autosave Post array - the autosave that is about to be saved. */ do_action( 'wp_creating_autosave', $new_autosave ); return wp_update_post( $new_autosave ); }Same issue with woocommerce, that was solved by disabling Wp Seo.
- This reply was modified 9 years, 8 months ago by mkdgs.
Forum: Plugins
In reply to: [Custom Taxonomy Templates] Fix translation and template nameThe problem appear if you use WordPress in a different language than the developper.
For exemple i am french and “category” is translated to “Catégorie”.
So “Category template” not work. Using singular name it can be tricky.