• Resolved D.pinon

    (@dpinon)


    Hello,

    I’m using the blog style homepage when no featured category choosen in theme option. It allows me to display the beginning of articles on the homepage instead of the excerpt.
    However I need to delete the summary of each article in Excerpt field on Post Edit screen.

    Is there a way to let the theme display the beginning of articles on the homepage without deleting the text in excerpt field ?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Theme Author Richie KS

    (@rkcorp)

    not quite understand. what’s the different between beginning of article and auto excerpt?

    do you mean the “excerpt field” metabox in write post?

    Thread Starter D.pinon

    (@dpinon)

    Yes, the excerpt metabox in each article : https://theme-fusion.com/wp-content/uploads/2015/03/Excerpt-Meta-Box.png

    When I say the beginning of article, I mean the auto excerpt, sorry.

    Theme Author Richie KS

    (@rkcorp)

    try open lib/functions/theme-functions.php and replace line 499

    function dez_get_custom_the_excerpt($limit=”,$more=”) {
    — more code —
    }

    to this

    function dez_get_custom_the_excerpt($limit='',$more='') {
    global $post;
    $thepostlink = '<a class="readmore" href="'. get_permalink() . '" title="' . the_title_attribute('echo=0') . '">';
    $custom_text = get_post_meta($post->ID,'post_custom_text',true);
    if($custom_text) {
    if($more) {
        $excerpt = $custom_text . $thepostlink . $more . '</a>';
        } else {
        $excerpt = $custom_text;
        }
    return $excerpt;
    
    } else {
    
    $content = wp_strip_all_tags(get_the_content() , true );
    //remove caption tag
    $content_filter = preg_replace('<code>\[[^\]]*\]</code>','',$content);
    //remove email tag
    $pattern = "/[^@\s]*@[^@\s]*\.[^@\s]*/";
    $replacement = "";
    $content_filter = preg_replace($pattern, $replacement, $content_filter);
    //remove link url tag
    $pattern = "/[a-zA-Z]*[:\/\/]*[A-Za-z0-9\-_]+\.+[A-Za-z0-9\.\/%&=\?\-_]+/i";
    $replacement = "";
    $content_filter = preg_replace($pattern, $replacement, $content_filter);
    
    if($more) {
        $excerpt = wp_trim_words($content_filter, $limit) . $thepostlink.$more.'</a>';
        } else {
        $excerpt = wp_trim_words($content_filter, $limit);
        }
    return $excerpt;
    }
    }
    Thread Starter D.pinon

    (@dpinon)

    Thanks Richie.

    I’ve replaced from line 499 to 531 and i’ve put your new code. But on the homepage where the excerpt is normally displayed, I get this :
    Warning: preg_replace(): Unknown modifier ‘\’ in wordpress\wp-content\themes\mesocolumn\lib\functions\theme-functions.php on line 515

    Thread Starter D.pinon

    (@dpinon)

    Any idea ?

    Theme Author Richie KS

    (@rkcorp)

    the code work for me, see if there’s any issue when copy paste the code like quot vs quot etc ‘ ”

    Thread Starter D.pinon

    (@dpinon)

    Ok, thanks Richie.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Blog style homepage’ is closed to new replies.