Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter gippo

    (@gippo)

    Thank you for your support, but I don’t have those settings, I didn’t install PrintFriendly plugin, it is great by the way but I need the print icon ton be consistent with other icons as in the AddToAny plugin.

    Thread Starter gippo

    (@gippo)

    Thank you for your prompt reply!

    Thread Starter gippo

    (@gippo)

    @roch,

    thank you, my question had been answered, the advice from Brian was what I needed.
    Thanks Brian!

    Thread Starter gippo

    (@gippo)

    Thank you, at the momento Javascript is out of my league and it is not a big deal saving the draft forcing the TinyMCE to load the stylesheet, I just wanted to be sure if there was an easy way.

    Thread Starter gippo

    (@gippo)

    Thank you Fabio,

    I am sorry I have not been clear. I was referring to the dashboard, the TinyMCE editor without plugin of sort.

    I have 3 page templates in the folder “page-templates” called:
    prose-template.php
    poetry-template.php
    playwright-template.php

    The “style.css” in the root folder of the child theme I am using takes care of the customisation for each page template, mainly typographic styles.

    Then I created 3 editor styles so that I can mirror the style of the published page in the editor:
    editor-style-prose-template.css
    editor-style-poetry-template.css
    editor-style-playwright-template.css

    Then I added this code to functions.php

    function my_editor_style_conditional() {
    
    	global $post;
    
    	// Edit post (pre_get_posts).
    
    	if ( stristr( $_SERVER['REQUEST_URI'], 'post.php' ) !== false 
    
    		&& is_object( $post )
    		&& 'page' == get_post_type( $post->ID ) ) {
    
    		if ( get_page_template_slug( $post->ID ) == 'page-templates/poetry-template.php' ) {
    			add_editor_style( 'editor-style-poetry-template.css' );
    		}
    
    		else if ( get_page_template_slug( $post->ID ) == 'page-templates/prose-template.php' ) {
    				add_editor_style( 'editor-style-prose-template.css' );
    		}
    
    		else if ( get_page_template_slug( $post->ID ) == 'page-templates/playwright-template.php' ) {
    			add_editor_style( 'editor-style-playwright-template.css' );
    		}
    	}
    }
    add_action( 'pre_get_posts', 'my_editor_style_conditional' );

    When I create a new page based on those templates the editor-style-…-template.css is not loaded until I save the page as draft or I publish it. I was wondering if there is a way to load the editor style when I select the page template from the dashboard.

    At https://codex.www.ads-software.com/Function_Reference/add_editor_style there is a guide on “Choosing Styles Based on Post Type” but I couldn’t adapt that code to my situation.

    Thread Starter gippo

    (@gippo)

    Well, it works!
    Thank you for your help and for commenting your code, quite instructive.

    I don’t understand completely yet what you are saying about my PHP notices, but it’s a starting point for me to learn a little bit more.

    Thread Starter gippo

    (@gippo)

    Thank you Craig for your reply and for spotting my mistake, but it was only a copy/paste mistake, in fact I did use is_page_template ( ) but it doesn’t work.
    My investigation lead me to think that the above mentioned function doesn’t work with the loop and it should be used instead the function get_page_template_slug ( ) so I tried to rewrite the code, posted below (please note: “page-templates” is the directory where the page templates are stored), but even this one doesn’t work.

    if (get_page_template_slug ( $post->id ) == "page-templates/my-template.php") {
    	add_filter( 'the_content', 'auto_word_style' );
    	function auto_word_style( $text ) {
    	$text = str_replace( '*', '<span class="auto-style">* * *</span>', $text );
    	return $text;
    	}
    }
    Thread Starter gippo

    (@gippo)

    Thank you again for your prompt reply. Actually I solved the problem adding !important at your css file in a couple of lines. It seems it is the only way I can change the style.
    As in:

    width: auto !important;
    background: #fff !important;

    The backend still doesn’t work, and I noticed that when I try to modify a parameter there I get kicked out to the root site, so I think there is something interfering that is somehow related to the multisite setup.

    Thread Starter gippo

    (@gippo)

    Thank you for your prompt reply.
    I am having problems even modifying the css file manually, but probably because I am running a wordpress multisite and your plugin is not compatible with it, in fact when I change a parameter and I get out of the setup page in the back end and then get back to the setup plugin page I see that the changes have not been saved. I hoped that coding manually the css file would resolve this issue but there is no change in the output.

Viewing 9 replies - 1 through 9 (of 9 total)