How can I add a css file into my TinyMCE template? - asp.net

My question is about Tinymce Template Plugin.
I have been developing a CMS with ASP.NET MVC. I can insert a template by using “insert template plugin”, but I can not insert a css file.
The template I will insert should be more developed. When I add a css file, it does not work. For example, <link rel=“stylesheet” type=“text/css” href=“theme.css”>. This link is my template I want to use.
And then I am saving this content into my database. This link can not be saved into my database. It can not be seen.
I used content_css ,the template looks good in the editor, but when I look at the page, it looks very bad because the css files does not work. In addition to all of these, when I look at the table of database (column : content) there are not css links (<link href...)
What should I do for this problem ? Thanks for your help.

CSS links belong in the head of the document, it is not valid HTML to add the link tag to the body. The Template Plugin allows you to add fairly involved HTML to the HTML body so you don't have to build that chunk of HTML over and over again. Please read the documentation for Templates: https://www.tiny.cloud/docs/plugins/template/
When you apply CSS in content_CSS it only affects how TinyMCE looks in the iFrame that the editor lives in. You need to get the CSS into the head of the page you are bringing over from your databse.

Related

In drupal 9. How can I add custom html between <head></head> Doing a hook or something rather than install a module

I am trying to add custom html between <head></head> Doing a hook or something rather than install a module.
But i cant figure how to doit.
I am using bartik and i make this function
function bartik_add_text_to_header(&$vars, $hook) {//}
but i cant figure how or which function to used.
I try with
drupal_set_html_head('style type="text/css">#import url(' . $GLOBALS[base_url] . '/modules/codefilter/codefilter.css);</style>');
But the drupal_set_html_head looks that is not existing in drupal 8 or 9
You should be using a custom theme with bartik as it's base theme rather than the bartik theme itself.
Just make the minimum file for a theme and set the bartik theme as it's base theme.
You can put whatever you want in the head section by overriding the template file that is currently being used to output that part of the html. For Bartik it is a file named html.html.twig in the core/themes/bartik/templates/classy/layout folder.
You would make a copy this file and put it into your custom themes templates folder so your file is used instead of the original.
To easily find what file is currently being used, you can enable twig debugging so comments are output in your html that show exactly what template files are being used.
Having said all that, and seeing as you are only looking to add css, you probably want to check out this page on Adding stylesheets (CSS) and JavaScript (JS) to a Drupal theme which will show you the different options you have to add js and css.
If you are just after a quick answer.... the function you want may be:
function fluffiness_preprocess_page(&$variables) {
$variables['#attached']['library'][] = 'fluffiness/global-styling';
}

how do i locate files in wordpress by inspecting element a particular element in google chrome?

I want to change some particular line on my Wordpress site which I cannot change in the customization. How do I locate a certain line with inspect element in chrome?
My website is www.Artiana.io and I want to edit this line:
"<h5 class="subscribe-description">Learn more</h5>"
Please, can anyone help me out?
Let me show you how you can use WordPress's hints in html body class to find the php file:
WordPress gives hint in the HTML's body tag that which particular template was used to display this page.
In your case we have following classes in the body tag:
<body class="home page-template page-template-page-templates page-template-page_front-page page-template-page-templatespage_front-page-php page page-id-466 custom-background wp-custom-logo blog-post">
Now there is a specific class which ends with php, which tells that template was used by your theme to build this page. i.e. page-template-page-templatespage_front-page-php
Now it could mean that in your theme folder:
/wp-content/themes/hestia/
There could be sub folder or folders called: **page-template/page-templates** and inside it is page_front-page.php PHP file, which is being used to create this layout. See if you can locate the code you are trying to modify there.

CKEditor for ASP.NET & custom tags

I need to edit an ascx file's content with CKEditor. The content of ascx is mostly pure html code. It also has a custom tags in it (I use a custom framework and its own custom tags, ie: )
CKEditor erases those custom tags automatically (since they are not valid HTML codes).
How can I add/define framework's custom tags into CKEditor so it would not erase them.
PS: those custom tags don't need to be rendered in HTML view as long as they stay in the source code.
You need to modify CKEDITOR.dtd object so editor will know this tag and correctly parse HTML and process DOM. See ckeditor how to allow for .insertHtml("<customTag myAttr='value'"></customTag>")
CKEditor's protectedSource feature solved my problem. the custom tag sits in regular html code and CKEditor ignores it which is exactly what I want. I will be using CKEditor for text modification only.
//example custom tag: <inc:module src="module_name" runat="server" />
// protect <inc:* /></*
config.protectedSource.push(/<([\S]+)[^>]*inc:*>.*<\/\1>/g);
// protect <inc:* />
config.protectedSource.push(/<[^>]+inc:[^>\/]*\/>/g);

creating wordpress custom php page

I'm trying my make my first theme for wordpress.
Is there any possibility to create custom php page to display custom content?
Pretty much adding to WordPress another copy of the likes of single.php, post.php or 404.php.
All I want just a page to display the custom content on it.
Every tutorial I found so far uses just creating new page within WordPress.
I want to avoid it and for custom page to be enabled straight after theme activation.
The Idea is to have something like my_custom_page.php and to be able link to it after.
Is there any way of doing it?
Thanks
here is the solution to what I was looking for
http://kovshenin.com/2014/static-templates/
To achieve custom page functionality you can use page template concept of wordpress. Creating a page template is extremely easy. Create any new file in your theme and start the file with a comment block like so:
<?php
/*
Template Name: My Awesome Custom Page
*/
<h1>Hello There</h1>
You need paste php code inside this template file. When you submit for then redirection action will be page with custom template page.
Referance :
https://premium.wpmudev.org/blog/creating-custom-page-templates-in-wordpress/
Video :
https://youtu.be/1ZdHI8HuboA

use javascripts objects into a wordpress theme

I save an html page that has an image rotator that work by using javascript, and after I save it work correctly.
I convert this html page to a wordpress theme but the rotator don't work anymore.
what's the problem?
please help me.
Wordpress insert embeded jquery script using wp_enqueue_script.
Check that jQuery inserted just one time in your theme! You can disable auto insertion by adding this code in function.php file:
wp_deregister_script('jquery');
and take a look at this.

Resources