Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #624763

    Hi,
    I would like to decrease the excerpt length and add a “Read More” text (on the text line belove the excerpt – line break ) on this page: http://www.veteranseilas.no

    I am using the Blog post module to get the post…

    Possible?

    #626143

    Hey dalboslampen,

    Thank you for using Enfold.

    Did you set the “Define Blog Grid layout” of the blog posts element? You can set it to Title and Excerpt + read more link.

    Best regards,
    Ismael

    #626161

    Hey dalboslampen,

    Please add the below code in your child theme functions.php from Appearance > Editor
    Adjust the value 100 to suit your character length in line “return currentText.substr(0, 100);”
    The other one is for blog post titles you can change 50 to any number of characters that suits your design well.

    For more information on child theme please check http://kriesi.at/documentation/enfold/using-a-child-theme/

    // Excerpt length
    function custom_excerpt(){
    ?>
    <script>
    jQuery(window).load(function(){
        jQuery('.post-entry').each(function() {
         	jQuery(".entry-content > p").text(function(index, currentText) {
         		return currentText.substr(0, 100);
    		 });
        	jQuery(".entry-title a").text(function(index, currentText) {
         		return currentText.substr(0, 50);
    		 });
        });
    });
    </script>
    <?php
    }
    add_action('wp_head', 'custom_excerpt');

    Best regards,
    Vinnie

    #767765

    Hi Vinnie, I just found your solution and applied it but it seems to not work anymore as you can see on my blog.

    I copied your code as is in the Child functions.php but I have still very short excerpts for my blog entries :-(

    Any tip for me ?

    #768935

    Hi Dioplr,

    You could try 200 or 250 characters here return currentText.substr(0, 100);

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #819110

    I have made some changes to get the full word. (not trim the word)

    // Excerpt length
    function custom_excerpt(){
    ?>
    <script>
    // trim sentence by 22 words
    	function trimByWord(sentence,wordcount = 22) {
    		var result = sentence;
    		var resultArray = result.split(" ");
    		if(resultArray.length > wordcount){
    		resultArray = resultArray.slice(0, wordcount);
    		result = resultArray.join(" ") + "...";
    		}
    		return result;
    	}
    jQuery(window).load(function(){
        jQuery('.post-entry').each(function() {
         	jQuery(".entry-content ").text(function(index, currentText) {
      
         		return trimByWord(currentText);
    		 });
        	jQuery(".entry-title a").text(function(index, currentText) {
       		return trimByWord(currentText,15); // trim title by 15 words
    		 });
        });
    });
    </script>
    <?php
    }
    add_action('wp_head', 'custom_excerpt');

    Hope it help you all!
    Best

    #819160

    Hi milfont,

    Thanks for sharing! Much appreciated :-)

    Best regards,
    Rikard

    #825085

    This doesn’t seem to be working for me using the Avia editor, but does if the post uses the default editor.
    I saw that under Screen Options I can enable Excerpt while using the Avia Editor and post text in there but it doesn’t cut it all at whatever amount of charters I set using the code above. It instead post the entire thing in from the Excerpt box.

    As you know the AVIA editor is way better as I can lay a post how I want better and work in either videos or a gallery way easier.
    Ultimately it would be great if the Excerpt could pull right from the AVIA eiditor without having to paste text in a different area, especially when it is the end client doing the post, but I guess a “use as excerpt” option would have to be added to a text block when editing.

    Either way is there a way to limit the excerpt length automatically when using AVIA like it does with the default editor?
    This will help make it way easier plus keep everything looking more even on the main Blog page.
    Here is the blog http://www.itsgreektomemn.com/news/
    Right now I just pasted the same text for all 3 posts into the Excerpt editor found under screen options, but this way does not limit the excerpt length.

    Limiting or setting the excerpt length differently on when using the “Latest New” widget on a sidebar or footer would be nice also.
    Where 200-250 charters might work great on the main blog page, on a side bar I imagine a lot of people would want to set that closer to 100.

    Thanks
    Jon

    #829823

    Hi,

    Can you please create your own topic, with your details, what yu want to create and how it should work?
    We would really appreciate if you can do that for us.

    Thank you very much

    Best regards,
    Basilis

    #1017894

    Hello
    Please, on my website http://www.mairaalgarve.com.br, the blog post element does not display text along with the link read more.
    I set the three options and in all displays only read more.

    Thanks
    Catia

    • This reply was modified 6 years, 2 months ago by catiasilveira.
    #1018757

    Hi,

    Are you using the advance layout builder (ALB) for your posts? The content of the ALB will not display on the blog overview page by default. You need to add an excerpt to the posts manually. Edit one of the posts and then enable the “Excerpt” box from the “Screen Options”. The Screen Options is located at the top right corner of the post editor page.

    Best regards,
    Ismael

    #1028948

    Thanks Ismael
    Sorted out.

    #1029137

    Hi,

    Great, glad you got it working :-)

    Best regards,
    Rikard

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Excerpt length and Read more / Blog post display’ is closed to new replies.