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

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;
}

Related

Why is a line break (<br />) being added to my image URL?

My website is built on WordPress and using the theme Divi. I am writing a new post and using the Divi image module to add images. In the editor the image shows up fine, however when the post is previewed or published, the image doesn't show up. Upon inspection, the URL for the image has a <br /> in it which is breaking the link to the image.
Any idea why this is happening? Thanks in advance.
Are you putting your image directly with the text editor or a you writing your text separatly ? With divi's page builder you can add an image to a block or widget, and write the text inside separatly.
I also have the same issue - Divi image module - generates a wrong path of image src.
I also have no solution, but I built a work around until the cause is found and have concrete solution.
function change_url_the_content($content){
$content = preg_replace("/br\%20\//", "", $content );
return $content;
}
add_filter("the_content", 'change_url_the_content', 9999999);

Want to remove "background" text

How can I remove the text background=""> from my Wordpress site?
The address is https://www.mybestroadbikes.com
Thanks!
You need to delete if from the page source itself.
Here is where is the extra String
Hope this helps :)
EDIT:
I am not sure how you page is structured in WordPress but you can try when you are on the home page just click Edit Page in the top menu.
After that you will ed up in a Dashboard window with some RichTextBox on it. On the right side you have to option to switch to Text instad of Visual. When you do that I think you will be able to locate the extra String and remove it:
Please check your body tag in header.php
The tag must must have been closed incorrectly.
You've got an issue with whatever mechanism you have used to insert Google Tag Manager. Use another method to whatever you have used or check your syntax because there's a syntax error with it. You can easily embed the script in the header using the hook wp_head.
function child_theme_head_script() { ?>
<script>
//Script here
</script>
<?php
}
add_action( 'wp_head', 'child_theme_head_script' );

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 Editor Image for Shortcode

Quick question about WordPress. I've been Googling all over the place and cannot find an answer.
Basically I'm looking to replicate what happens when you add a gallery: have an image displayed as a stand in for the gallery shortcode [gallery]. The shortcode's visible when you go to edit HTML.
I'd like to exactly copy this effect: When a shortcode inserted into the editor I'd like for to to be rendered as an image.
Things I've Tried:
Inserting an element (image, div, I found an input is pretty unfuckwithable, etc) that's wrapped by a shortcode (This works ok, not great. The short code's still visible and WP will auto add paragraphs to the element to create space that users could, possibly, add content that'll be eaten by the short code) -
Inerting the short code as a < !-- --> comment (This also doesn't work great, WP will occassionally eat it moving between Visual/HTML. The comments ALSO eat your content < !-- [shortcode]--> placeholder < !--[/shortcode] --> = < !-- rendered shortcode -->)
That's the extent that I've thought of things. I cannot find a guide on how to do mimic the [gallery]'s behavior and can't find it by going through wp-admin's guts.
Thanks!
Alright, found the answer thanks to Dan's hint. Here's how to do it:
First (as Dan suggested) take a look at how they add the Gallery plugin to Tiny MCE. There's actually an uncompressed js file that will give you the overview you need, find it in:
/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js
This goes over the basics on adding this type of plugin to TinyMCE (more info here). To get WP to load the .js file with your TinyMCE plugin, see this helpful guide.
Basically here's the code:
if ( get_user_option('rich_editing') == 'true') {
add_filter("mce_external_plugins", "add_jolokia_tinymce_plugin");
//Applying the filter if you're using the rich text editor
}
function add_jolokia_tinymce_plugin($plugin_array) {
$plugin_array['example'] = '/path/to/example.js';
return $plugin_array;
}
Add this to a plugin or function.php in a theme And you're good!

How to add a mailto button to TinyMCE

I need to add a mailto button to TinyMCE in WordPress. Has anybody already done this? Or any tops on how to go about it?
Given you are wanting to put this into WordPress I assume you want to simply insert a href="mailto:" type tag into your document for the currently selected text.
The simplest way is to create a basic plugin. You can do this in the same page that tinyMCE is initialised into. The example below will wrap the currently selected text with a static mailto.
tinymce.create('tinymce.plugins.MailToPlugin', {
init : function(ed, url) {
ed.addCommand('mceMailTo', function() {
var linkText = ed.selection.getContent({format : 'text'});
var newText = "<a href='mailto:foo#bar.com?subject=testing'>" + linkText + "</a>"
ed.execCommand('mceInsertContent', false, newText);
});
// Register example button
ed.addButton('mailto', {
title : 'MailTo',
cmd : 'mceMailTo',
image : url + '/images/mailto.gif'
});
}
});
// Register plugin with a short name
tinymce.PluginManager.add('mailto', tinymce.plugins.MailToPlugin);
You will of course need to create an image (mailto.gif) for the toolbar button.
You then simply add the following to your plugin list
plugins: '-mailto'
and put mailto on the toolbar.
Of course, if you want to allow the end user to specify the email address and subject, then you will need a dialog. There is a good example of how to create a plugin on the TinyMCE site in Creating a Plugin
Unfortunately I can't comment on how you would do either of these in WordPress but I suspect you will need to customise your version of WordPress tinyMCE plugin.
You can use the class I built in WordPress my tutorial and then make the calls to your javascript files through instantiating the class. At least, regarding the reference to adding it to your plugins.
Cheers
First of all, make sure you have tinyMce Advanced plugin installed. Then, you can just use the insert / edit link button from the tinyMce editor. You don't need a different button. In the destination URL add this
mailto:my-mail#my-domain.com

Resources