Only CSS to open link in a new tab - css

Hello I have the following problem: I have my website made in Wordpress, and I have a 3D Cover Carousel plugin there, which shows me a gallery of photos in 3d. The thing is that when I click on the image I want the link to be opened in a NEW tab. In the plugin settings there are no such an option. The plugin html is a short code added to my page. So the only thing I can change is Additional css. So is there any options to make a link be opened in a new tab only with css?

As it was previously stated here, there is no way to do this with pure CSS.
If you can use JavaScript, you can target the item and add it the attribute target="_blank".
document.getElementById("element").setAttribute("target", "_blank");

document.getElementById("element").setAttribute("target", "_blank");
You can add this piece of js in your footer.php file.
Another method is to add a js file and include it using wp_enqueue_script function in your function.php file.

Related

NEED HELP - how to make an excerpt of the post clickable?

I am working in Wordpress, and I am using Elementor. Elementor has a native feature for the title of the posts and images to link to the post.
But if I add an excerpt text, it doesn't link to the post. It is not clickable. The read more button does, but not the excerpt of the post.
I am trying to create something like this: greatist.com Every post on their website is clickable - the excerpt, the title, and the image.
My excerpts are really short like on that website, and I would really like them to be clickable. I have absolutely no idea how to do this and I'm beginning to think it's not possible. I am using Hello Elementor theme.
I would deeply appreciate anyone's help. I just registered to ask this question.
You can always try to save text as an photo and make it clickable or make a full section clickable.To do this try to use plugin called "Make Column Clickable Elementor".
Add this code to your website:
const postExcerpts = document.querySelectorAll('.elementor-posts .elementor-post .elementor-post__excerpt');
postExcerpts.forEach(postExcerpt => {
const postUrl = postExcerpt.parentNode.querySelector('.elementor-post__title a').href;
postExcerpt.addEventListener('click', () => {
window.location.href = postUrl;
});
});
This can be added using a script tag. Choose from the following options:
Add this code as a script tag in your functions.php file, to be rendered at the end of the page (wp_footer action hook).
If you have Elementor Pro, use its built-in Custom Code feature to add the code in a script tag to the end of the body tag.
It's recommended to add a pointer cursor so the user will know the excerpt is a link. This can be achieved by adding the following CSS to your style.css file.
.elementor-posts .elementor-post .elementor-post__excerpt {
cursor: pointer;
}

How can I add a css file into my TinyMCE template?

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.

How to add custom css in wix website

I am new at wix and editing a website and want to add css in a page. but not found any option for css.
Anybody know how to add custom css code in wix website?
Thanks
You can do this by embedding inline styles to every page, via creating a chunk of custom css code contained between <style> and </style>.
Go to your site's dashboard.
Click Manage Website on the left.
Click Tracking & Analytics.
Click + New Tool **and select **Custom from the dropdown.
Set up your custom code:
Enter your custom code.
Select the relevant domain. Note: This option will appear only if you have multiple domains.
Enter a name for your custom code.
Add Code to Pages: Select which pages to add your code to:
**All Pages: **Click the dropdown to select an option:
Load code once.
Load code on each new page.
**Choose specific pages: **Begin typing the name of the relevant pages and then click the checkbox next to the relevant page.
Place Code in: Select where the code snippet in placed in your site's code:
Head - as noted by #Daniel Gurtner, avoid this because it'll insert it BEFORE any of the inherent styles, which makes it mostly useless here.
Body - start
Body - end Note: I'd recommend adding your style chunk here to avoid having a delay effect on your loading
Click Apply.
Wix keeps on updating this but I have found where the place described in the most voted comment is for now. I don't have enough "reputation" to add a comment to the thread, hence why this is an answer.
Go to Settings and scroll to Advanced(the last section) and you can see Custom Code. The rest of the steps are the same.
Click Add on the left in the editor.
Click More → Embeds.
Drag the HTML iframe to the site.
Click your iframe and click Edit Code.
Then type:
<style>
/* CSS Code */
</style>
As of 2022, you can add it from your Wix Dashboard under Settings > Advanced > Custom code.
Click the Add Custom Code button. Enter your CSS in the Paste the code snippet here: textarea. Make sure to wrap it within <style type="text/css"></style> tags. Set the Code Type as "Essential" as it doesn't require user consent to load.
Note: You won't be able to see your CSS from the page editor nor Preview mode. You have to Publish it and view it from the frontend.
Wix Add Custom Code screenshot
Follow these steps to add CSS in Wix.
Go to your site’s dashboard.
Click Manage Website on the left.
Click Tracking & Analytics.
Click + New Tool **and select **Custom from the dropdown.
Set up your custom code:
Enter your custom code.
Select the relevant domain. Note: This option will appear only if you have multiple domains.
Enter a name for your custom code.
Add Code to Pages: Select which pages to add your code to:
If you need more help with Wix Web Development visit wix.com/forum.
I just tried it on 6th Sep 2021. Yes it is possible to add CSS & JS custom code.
At the same place of writing custom HTML code
For CSS code add,
<style type:"text/css"> CSS CODE HERE </style>
For JS Javascript code add,
<script> JS CODE HERE </script>
The steps in previous answers did not work for me. It seems the interface has changed.
The following steps work with the new UI:
Go to your site's dashboard
Click settings in the left sidebar
scroll down to the "Advanced" section
Click "Custom Code"
All carriage returns within the embedded code will show up as \n on the output, rendering the code non-functional.
You could also achieve this by setting the .html property of your object (#id) in Velo.
The following example adds a drop shadow to your object with id equal to #id:
$w("#id").html = "<p style='filter: drop-shadow(1px 8px 4px #4444dd)'>test</p>"
Below snippet shows the result in pure HTML.
<p style='filter: drop-shadow(1px 8px 4px #4444dd)'>test</p>
You can't. This is not a feature provided by Wix.
ref. other ref.

Wordpress - where should I place editable CSS

Where do I place things like header's image, background color, background image...? Should I simply add them to html code? Or add pieces of the CSS to functions.php?
Also, when I add some code to head section from functions.php - will this be loaded automatically, or should I add something more to the head section myself?
you can change style.css for any css change
and header.php for header section,footer.php for footer section
for home content index.php file
you can call function from function.php file in to these files
If the theme you are using already has the HTML, then just modify the style.css. If the theme doesn't support the image placements that you want, you can either try to modify the HTML files yourself, or ask the theme creator to add it for you. If you modify this yourself, you'll have to remember that future updates to the theme may overwrite your changes.
If you are creating your own theme and don't care about flexibility, then add a spot in the HTML using your tags.

Add class to all links created by tinyMCE in Wordpress

I'm attempting to automatically add a class to all links created when clicking the "link" button in tinyMCE. I've found this snippet in the tinyMCE docs:
// Adds a class to all paragraphs in the active editor
tinyMCE.activeEditor.dom.addClass(tinyMCE.activeEditor.dom.select('p'), 'myclass');
I think this will be what I need if I change it to apply to anchors.
Question 1: Think this will work? Know of a better way to do it?
Question 2: How and where do I add this snippet to my theme? The theme I'm working with has a tinyMCE folder in the functions directory.
Thanks!
So I ended up doing a jQuery fix rather than going through tinyMCE. Code as follows:
jQuery(document).ready(function(){
$("#content a").addClass("link_color");
});

Resources