Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #20147

    Hi,

    I have created a dynamic template for my blog page, showing an intro from a page with its slideshow and below with the “dynamic template element” BLOG.

    So far so good, but:

    - The “read more” (German: “weiterlesen”) is not linked

    - how can I get rid of the last three points at the end of the post excerpt?

    I have following code in my functions.php (to limit the post excerpt):

    /** Modify the length of post excerpts */

    add_filter( 'excerpt_length', 'custom_excerpt_length' );

    function custom_excerpt_length($length) {

    return 20; // pull first 50 words

    }

    function new_excerpt_more( $more ) {

    return;

    }

    add_filter('excerpt_more', 'new_excerpt_more');

    and in loop-index.php I have put this code (found somewhere here in the CORONA forum):

    <div class="entry-content">

    <?php

    if(strpos($avia_config, 'medium_image sidebar') !== false) echo $slider->display_small('blog');

    if(!is_single()){

    the_excerpt(__('Weiterlesen →','avia_framework'));

    echo ''.__('Weiterlesen →','avia_framework').'';

    }else{

    the_excerpt(__('Weiterlesen →','avia_framework'));

    }

    and in helper-templates.php I have put this code around line 856:

    if(is_single()){

    $content = get_the_content('<span class="inner_more">'.__('Read more →','avia_framework').'</span>');

    $content = apply_filters('the_content', $content);

    $content = str_replace(']]>', ']]>', $content);

    I don’t know PHP very well, and therefor I don’t know where and how to put the linking of “Read more”/”weiterlesen” and how to get rid of the last three points at the end of the excerpt.

    Could you please help me out?

    Thanks a lot!

    #106469

    ok, I’m very sorry, but I guess, I have messed up my CORONA files too much and so I have replaced the helper-templates.php and the loop-index.php with a fresh version from Themeforest.

    Now the errors mentioned above are again okay, forget them please.

    The problem that I have now is, that the code in my functions.php to limit the excerpt to 20 words, doesn’t take effect:

    /** Modify the length of post excerpts */
    add_filter( 'excerpt_length', 'custom_excerpt_length' );
    function custom_excerpt_length($length) {
    return 20; // pull first 50 words
    }
    function new_excerpt_more( $more ) {
    return;
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    At the moment the posts can only be effectively limited using the more-tag, but I would like to have an automatic limited excerpt.

    Why doesn’t work the code in the functions.php, is there any mistake in it? I’m using dynamic templates for my blog overview pages!

    Thanks a lot!

    #106470

    okay, I found – partly – a solution here.

    This works ONLY, if the blog overview page is created with dynamic-template-builder using the element “COLUMNS” for the output of the posts!

    But as soon as you create a blog overview page with dynamic-template-builder using the element “BLOG” to output the blog posts, then the excerpt does NOT work/take effect.

    What changes must I do then?

    Thanks.

    #106471

    Hi,

    Please take a look at line 498 of framework/php/functions-set-avia-backend.php .. there is a function there

    function avia_backend_truncate($string, $limit, $break=".", $pad="...")

    that deals with the three dots and truncation.

    You would use it like this to set your truncation and can add a parameter to make three dots into no dots or 5 dots.

    $excerpt = avia_backend_truncate($excerpt, $length," ");

    Thanks,

    Nick

    #106472

    thanks, Nick, that works for the question with the three dots.

    But what about my post directly above your answer here concerning the working post excerpts itself?

    The solution found here in the forum, replacing in includes/helper-templates.php this part of code

    $content = get_the_content('<span class="inner_more">'.__('Read more →','avia_framework').'</span>');

    with this

    if(is_single()){

    $content = get_the_content('<span class="inner_more">'.__('Read more →','avia_framework').'</span>');

    $content = apply_filters('the_content', $content);

    $content = str_replace(']]>', ']]>', $content);

    }else{

    $content = apply_filters('the_excerpt', get_the_excerpt());

    $content .= '<p><span class="inner_more">'.__('Read more →','avia_framework').'</span></p>';

    }

    causes, that this works ONLY, if the blog overview page is created with dynamic-template-builder using the element “COLUMNS” for the output of the posts.

    But as soon as you create a blog overview page with dynamic-template-builder using the element “BLOG” to output the blog posts, then the excerpt does NOT work/take effect.

    What changes must I do then?

    Thanks.

    #106473

    Hi,

    This is a bit abstract for me, I apologize. Would you show me a url where it works and a url where it doesn’t work please?

    I looked at the original question you linked to, and there is more than one place where the line you needed to replace appears in the theme. Have you replaced it in just one place or all of them?

    $content = get_the_content('<span class="inner_more">'.__('Read more →','avia_framework').'</span>');

    Thanks,

    Nick

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘"Read more" at dynamic template blog page is not linked’ is closed to new replies.