salemw (@salemw)

Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Try this one

    <?php echo ( get_topic_author());?>

    In reply to: Excerpts

    Well my friend found a solution for me and in case I wasn’t the only one asking for excerpt RSS

    here it is:

    Add this function to functions.bb-template:

    // excerpt for rss
    function post_text_excerpt( $post_id = 0 ) {
    echo apply_filters( 'post_text', get_post_text_excerpt( $post_id ), get_post_id( $post_id ) );
    }

    function get_post_text_excerpt( $post_id = 0 ) {
    $bb_post = bb_get_post( get_post_id( $post_id ) );
    // Number max of characters
    $max_rss=250;
    $excerpt_rss = $bb_post->post_text;

    if (strlen($excerpt_rss)>$max_rss) {
    $excerpt_rss = substr(ltrim($excerpt_rss), 0, $max_rss);
    preg_match('<code>.+(?=[,;.])</code>s', $excerpt_rss, $out1);
    preg_match('<code>.+(?=[ ])</code>s', $excerpt_rss, $out2);
    if ( ( strlen($out2[0]) - strlen($out1[0]) ) < $tronque_maxi) {
    $excerpt_rss = $out1[0];
    } else {
    $excerpt_rss = $out2[0];
    }
    if (preg_match('<code>.+(?=(de|du|dans|le|la|a|à)$)</code>s', $excerpt_rss, $out3)) {$excerpt_rss = $out3[0];};
    return $excerpt_rss."...";
    } else {
    return $excerpt_rss;
    }
    return apply_filters( 'get_post_text', $excerpt_rss, $bb_post->post_id );
    }
    // end excerpt for rss

    And replace post_text() par post_text_excerpt() in my-templates/your_template/rss2.php

    The author website:

    http://messouvenirs.net/

    In reply to: Excerpts

    Anybody ?

    That would also be great to have excerpt for the rss feed

    There is no point for a feed if it doesn’t brings you any traffic.

    In reply to: Excerpts

    I like that

    how can we get the forst post instead of the last one ?

    i would love to be able to change it to french also

    Thanks !

    Amazing, and so simple

    Thank you chrishajer

    yes, i did went to that topic earlier, I searched the whole forum but I just don’t get how i should use it I tried : global $topic_id, $forum_id; include(‘../nav/’.$forum_id.’.php’);

    it works fine but only on forum pages. not on topics. The same with an earlier post asking for different stylesheets:

    <link rel="stylesheet" href="<?php if ($forum_id == 1) bb_stylesheet_uri(); elseif ($forum_id == 2) echo '/my-templates/kakumei-blue/style.css'; ?>" type="text/css" />

    It”s ok on forum but not on topics.

    So in my header if I do the routine:

    global $topic; echo “$topic->topic_title”; I get the topic title ok but nothing with

    global $bb_post; echo “$bb_post->forum_id”;

Viewing 7 replies - 1 through 7 (of 7 total)