Digital experiences for all disciplines
Forum Replies Created
-
Posted in: We hit Power Elite.
-
On your side, yes lol !!
Thanks !
Conflict with plugin… (easy content type in my case)
This is really a mess… 🙁
Each time a page is updated these shitty tags are everywhere !!!As I said,
remove_filter( 'the_content', 'wpautop' );
remove them, but THROUGH ALL the website.
In my case I have lot of pages, so it’s not an option : I should re-design all the content by adding ‘normal’ <p> and <br/> by hand…It seems like this is a new behavior in TinyMCE 4, added to WP 3.9 : View article
I’ve tried the suggested customization method :
function myformatTinyMCE($in) { $in['remove_linebreaks']=true; $in['gecko_spellcheck']=false; $in['keep_styles']=true; $in['accessibility_focus']=true; $in['tabfocus_elements']='major-publishing-actions'; $in['media_strict']=false; $in['paste_remove_styles']=true; $in['paste_remove_spans']=true; $in['paste_strip_class_attributes']='none'; $in['paste_text_use_dialog']=true; $in['wpeditimage_disable_captions']=true; $in['plugins']='inlinepopups,tabfocus,paste,media,fullscreen,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,wpfullscreen'; $in['content_css']=get_template_directory_uri() . "/editor-style.css"; $in['wpautop']=true; $in['apply_source_formatting']=false; $in['theme_advanced_buttons1']='formatselect,forecolor,|,bold,italic,underline,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,wp_fullscreen,wp_adv'; $in['theme_advanced_buttons2']='pastetext,pasteword,removeformat,|,charmap,|,outdent,indent,|,undo,redo'; $in['theme_advanced_buttons3']=''; $in['theme_advanced_buttons4']=''; return $in; } add_filter('tiny_mce_before_init', 'myformatTinyMCE' );
But by doing this Switch Page builder is not loading anymore…
We should dig into this..
Argh, got it..
/* ALTER QUERY FOR SESSIONS ARCHIVES + SESSIONS TAXONOMY ARCHIVES > ORDER BY META_VALUE =================================================================================================== */ function alter_query($query) { if ( is_admin() || ! $query->is_main_query() ) return; global $wp_query; if ( is_post_type_archive( 'sessions' ) ){ $query-> set('post_type' ,'sessions'); $query-> set('orderby' ,'meta_value name'); $query-> set('meta_key' , 'fc_start_datetime'); $query-> set('order' , 'ASC'); } } add_action('pre_get_posts','alter_query'); function alter_query2($query) { if ( is_admin() || ! $query->is_main_query() ) return; global $wp_query; if ( is_tax( 'sessions_taxonomy' ) ){ $query-> set('post_type' ,'sessions'); $query-> set('orderby' ,'meta_value name'); $query-> set('meta_key' , 'fc_start_datetime'); $query-> set('order' , 'ASC'); } } add_action('pre_get_posts','alter_query2');
Adding a !is_admin check resolved the problem of theme breaking
Creating 2 different functions for archives and taxonomy also.Ok thank you
This reply has been marked as private.Ok, I’ve tried
is_post_type_archive( $post_types )
rather thanis_archive()
:add_action('pre_get_posts','alter_query'); function alter_query($query) { global $wp_query; if ( is_post_type_archive( 'sessions' ) ){ //$query-> set('post_type' ,'sessions'); $query-> set('orderby' ,'meta_value name'); $query-> set('meta_key' , 'fc_start_datetime'); $query-> set('order' , 'ASC'); } }
Good points :
– Only custom post type archive and taxonomy archives are affected by the change.
– Other post types archives are not affected by the change.But :
– it kind of breaks the layout (no more main menu displaying, issues in right column, etc…)Any idea ?
Hi Mohammad,
I’ve modified the code like this, to apply to my ‘sessions’ custom post type, and to sort by custom field ‘fa_start_datetime’ :
add_action('pre_get_posts','alter_query'); function alter_query($query) { global $wp_query; if ( is_archive() ){ $query-> set('post_type' ,'sessions'); $query-> set('orderby' ,'meta_value name'); $query-> set('meta_key' , 'fc_start_datetime'); $query-> set('order' , 'ASC'); } }
It’s working great but now all my archive pages (even from other post types) are displaying ‘sessions’ !
Also I have some dropdown filters on the right column of archive page and they are not displaying anymore..
I’d like to target order only on archive-sessions.php and taxonomy-sessions_taxonomy.php
Thx )
It happens in both existing and new pages.
The main theme code is untouched, working with child-theme.
I’ll try tomorrow to de-activate all plugins and child-theme, I’ll keep you posted.
Thx
@Ed – no, this IS the issue: they are outputting on the frontend..
Hi Ed, not sure.. I’m talking about editor I think :
In my example above, the code is inserted through a text block.
> it happens when we need to use the ‘wysiwyg’ shortcodes (lists, buttons, icons, etc…)
> it also happens when we ‘hardcode’ page builder shortcodes into text blocks (it was necessary for columns before you released the ‘row’ shortcode 😉For new content we could use Raw HTML shortcode maybe… but I’ve tested and here is the default render:
<p>This is a raw html block.<br/>Click the edit button to change this html.</p>
http://d.pr/i/aF6WIt can easily be correcte for new content, but :
– behaviour is really annoying and not user friendly
– it’s a total mess for already created contentFor the main editor shortcodes the update has worked.
But for shortcodes inside text fields (‘nested’) the new WP editor is messing with br and p tags.
Using
remove_filter( 'the_content', 'wpautop' );
will definitely mess all my pages, while removing added p&br tags is also messy :-/A simple example :
unordered list shortcode :[list] [list_item icon="ss-plus"] Standard Rooms : 30 m2 / 323 sq ft[/list_item] [list_item icon="ss-plus"] Free Broadband WiFi internet[/list_item] [list_item icon="ss-plus"] TV LCD - HD[/list_item] [/list]
Render :
<p>[list]<br /> [list_item icon=”ss-plus”] Standard Rooms : 30 m2 / 323 sq ft[/list_item]<br /> [list_item icon=”ss-plus”] Free Broadband WiFi internet[/list_item]<br /> [list_item icon=”ss-plus”] TV LCD – HD[/list_item]<br />[/list]</p>
Hi Mohammad,
yes I was already in 2.5.3 when making my previous comment.
THANKS a lot for this quick update. New editor is now showing well.
However the shortcodes are still rendering with messy <br/> and <p> :-/ …
-
Posted in: We hit Power Elite.