WordPress.org

Ready to get started?Download WordPress

Forums

WYSIWYG Editor CSS menu (4 posts)

  1. watershed
    Member
    Posted 7 years ago #

    Hi,

    I'm new to WordPress and liking what I find so far!

    I'm looking to run WP as a CMS for a client who doesn't have HTML editing knowledge. With this in mind, I've managed to customise tiny_mce_gzip.php so that it displays only the options I want, including a select menu for styles and formats.

    I have in mind to use the content_css option to populate the style select menu.

    (I note that by default the style menu seems to be populated with the css selector content of:
    wp-includes/js/tinymce/plugins/wordpress/wordpress.css, and that appending to this file does not add any options to the style menu.)

    It seems I can populate the select menu with an absolute link to:
    http://web-site-domain/wp-content/themes/theme-name/stylesheet-name.css

    ...but I can't get a relative link to work! I've tried:
    ../../../wp-content/themes/[theme-name]/[stylesheet-name.css]

    What should it be?
    Any help much appreciated.

  2. rene1960
    Member
    Posted 7 years ago #

    How much do you get paid by this cliƫnt?

  3. Copernicus
    Member
    Posted 7 years ago #

    Hi Watershed,

    Can you provide any specifics on how you've modified the file "tiny_mce_gzip.php" to accommodate the styles selector?

    Under the call for "initArray" within the file "tiny_mce_gzip.php" (at, approximately, line 161) I've added the line content_css : "http://www.mydomain.com/wp-content/themes/mythemename/editor.css"
    (where "editor.css" is a specific CSS file intended for the drop-down style selector within the WYSIWYG editor in WP).

    However, this didn't seem to have an effect, since the WYSIWYG editor only still offers the styles of "mce_plugin_wordpress_more" and "mce_plugin_wordpress_page".

    How did you get it working so that the styles from your CSS file (such as "editor.css" in my case) were available from the drop-down?

    (If you can show me how to make it work with an absolute path to the CSS, I'll do what I can to make the relative path work!).

    Thanks!

  4. Copernicus
    Member
    Posted 7 years ago #

    Update: I apologize for the error above. The calling of the custom CSS did work with the method I described. (It was a simple matter of the old version of "tiny_mce_gzip.php" being stuck in the site cache.)

    And, as a bonus, I've solved the issue of the "relative" path for the custom css.

    As noted above, my absolute path was something like:
    http://www.mydomain.com/wp-content/themes/mythemename/editor.css

    And, if you look at ""tiny_mce_gzip.php" under the called for initArray (where we've added the "content_css :" line) you'll see a line that reads:
    "document_base_url : "<?php echo trailingslashit(get_bloginfo('home')); ?>",
    This code sets the base directory for WordPress. So, you can make a relative path from here and it will work fine.

    In my example, I switched my absolute path to "/wp-content/themes/mythemename/editor.css" and it works fine.

    Hope this helps!

Topic Closed

This topic has been closed to new replies.

About this Topic