Missing Read more button in category post archive and tag archive

  • cindydenkt

    #3358

    http://www.cindyhesse.nl

    I

    – use the update version graphene version 1.6

    – made a childtheme.

    – uploaded the gaphene files in the graphene theme, tag.php, loop.php etc. (Things you should do after updating the graphene theme, Post of Prasanna)

    I have a problem with the following search functions

    1. Category post archive (Zoek iets met – Search something about)

    2. Tag archive

    When I click on a category or tag I like to see

    Title of the post, text and Button Read more

    Isee in my archive the following lay out of the posts:

    – title and tekst

    – title, text and button readmore

    When I click on the catogory Aanbevolen blogs’ then the read more buttons are missing

    When I click on the tag (trefwoord) Kopi Luwak’ then the read more buttons is missing

    What are the things I have do to get my buttons Read more back?

    Anonymous

    #24483

    It seems you are using manual excerpts for some posts. Make sure you’ve selected Show More link for manual excerpts in Graphene Options –> Display –> Excerpt display Options.

    cindydenkt

    #24484

    I have allready selected the option Show More link for manual excerpts in Graphene Options –> Display –> Excerpt display Options

    For some posts it works for other not?

    The first category Aanbevolen blogs (5 posts)

    The first three post the buttons are missing, post 4 and 5 the buttons are back

    The category alle blogs (all blogs) (18 posts) Post 1,2 buttons are missing, post 3 button is missing, post 4–7 buttons are missing, post 8 – 17 the buttons are back

    Suggestions

    Anonymous

    #24485

    Hi Cindy… You can try to insert something like this into your child theme functions.php file:

    function graphene_custom_excerpt($text) {  // custom 'read more' link
    if (strpos($text, '[...]')) {
    $excerpt = strip_tags(str_replace('[...]', '... <a href="'.get_permalink().'">read more...</a>', $text), "<a>");
    } else {
    $excerpt = '<p>' . $text . '&nbsp;&nbsp;<a href="'.get_permalink().'">read more...</a></p>';
    }
    return $excerpt;
    }
    add_filter('the_excerpt', 'graphene_custom_excerpt');

    cindydenkt

    #24486

    This was a very strong php suggestion!

    Every post in the category of tag has on the left side the words read more …

    * Also the posts with buttons

    * Als the posts with no manual exerpts

    Is it possible to change the words in a button on the right side.

    And exclude the posts with buttons and posts with no manual exerpt

    Anonymous

    #24487

    Okay… let’s try this:

    function graphene_excerpt_more($more) {
    global $post;
    return '… <a href="'. get_permalink($post->ID) . '">» Read More</a>';
    }
    add_filter('excerpt_more', 'graphene_excerpt_more');

    function graphene_new_excerpt_length($length) {
    return 120; // Here you can control the length of your excerpt (word count)
    }
    add_filter('excerpt_length', 'graphene_new_excerpt_length');

    function graphene_trim_all_excerpt($text) {
    // Creates an excerpt if needed; and shortens the manual excerpt as well
    global $post;
    if ( empty($text) ) {
    $text = get_the_content('');
    }
    $text = strip_shortcodes( $text ); // optional
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]>', $text);

    $text = strip_tags($text);
    $excerpt_length = apply_filters('excerpt_length', 55);
    $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
    $words = preg_split("/[nrt ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
    if (count($words)> $excerpt_length) {
    array_pop($words);
    $text = implode(' ', $words);
    } else {
    $text = implode(' ', $words);
    }
    $text = $text . $excerpt_more;
    return $text;
    }

    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'graphene_trim_all_excerpt');

    I haven’t tested it… so if it causes an error, you should be prepared to FTP or CPanel to your site and remove the code from your child theme functions.php file if it breaks your site.

    cindydenkt

    #24488

    Josh and Prasanna. Thanks for your support. I struggled with this thing. It’s fixed now. Thanks!!

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Do NOT follow this link or you will be banned from the site!