Forum Replies Created

Viewing 15 replies - 1 through 15 (of 18 total)
  • Actually, I already tried that. This is the post (cut n’ paste from previous post) with what happened when I did:

    <?php remove_filter('the_excerpt', 'wpautop'); ?>

    from the template files (archive.php and index.php) and added:

    function trim_excerpt($text) {
      return rtrim($text,'[...]');
    }
    add_filter('get_the_excerpt', 'trim_excerpt');

    back into the functions.php file and got the same kind of error.

    apljdi: I took your function out because it conflicted with what I already have. I posted what I already have in hopes that you can guide me as to how to implement the trim so as not to conflict with what I already have. Can you help?

    Nope t31os’s function is not in my functions file anymore, this is what I have now in my functions file:

    <?php
    if ( function_exists('register_sidebars') )
     register_sidebars(2,array(
            'before_widget' => '',
        	'after_widget' => '',
     		'before_title' => '<h2>',
            'after_title' => '</h2>',
        ));
    ?>
    <?php
    function widget_mytheme_search() {
    ?>
    <h2>Search</h2>
    <form id="searchform" method="get" action="<?php bloginfo('home'); ?>/"> <input type="text" value="type, hit enter" onfocus="if (this.value == 'type, hit enter') {this.value = '';}" onblur="if (this.value == '') {this.value = 'type, hit enter';}" size="18" maxlength="50" name="s" id="s" /> </form>
    <?php
    }
    if ( function_exists('register_sidebar_widget') )
        register_sidebar_widget(__('Search'), 'widget_mytheme_search');
    ?>
    <?php
    add_filter('comments_template', 'legacy_comments');
    function legacy_comments($file) {
    	if(!function_exists('wp_list_comments')) : // WP 2.7-only check
    		$file = TEMPLATEPATH . '/legacy.comments.php';
    	endif;
    	return $file;
    }
    ?>

    and this is what I have in my archive and index templates:

    <div class="entry">
    <?php $count++; ?>
    <?php if ($count < 2) : ?>
    <?php the_content() ?>
    <?php else : ?>
    <?php remove_filter('the_excerpt', 'wpautop'); ?>
    <?php the_excerpt();?>
    <a href="<?php the_permalink() ?>">more</a>
    <?php endif; ?>
    </div>

    visiblemedia

    (@visiblemedia)

    ooops, double post by accident, sorry

    visiblemedia

    (@visiblemedia)

    then I tried adding this:

    <?php function trim_excerpt($text) { return rtrim($text,'[...]'); } ?>

    to this:

    <?php $count++; ?>
    <?php if ($count < 2) : ?>
    <?php the_content() ?>
    <?php else : ?>
    <?php remove_filter('the_excerpt', 'wpautop'); ?>
    <?php the_excerpt();?>
    <a href="<?php the_permalink() ?>">more</a>
    <?php endif; ?>

    so that it looks like this:

    <?php $count++; ?>
    <?php if ($count < 2) : ?>
    <?php the_content() ?>
    <?php else : ?>
    <?php remove_filter('the_excerpt', 'wpautop'); ?>
    <?php function trim_excerpt($text) { return rtrim($text,'[...]'); } ?>
    <?php the_excerpt();?>
    <a href="<?php the_permalink() ?>">more</a>
    <?php endif; ?>

    in the index.php and archive.php file and got all sorts of other errors… something about “cannot re declare the_exerpt” or something like that. and my sidebar disappeared.

    visiblemedia

    (@visiblemedia)

    hmm, I commented out:

    <?php remove_filter('the_excerpt', 'wpautop'); ?>

    from the template files (archive.php and index.php) and added:

    function trim_excerpt($text) {
      return rtrim($text,'[...]');
    }
    add_filter('get_the_excerpt', 'trim_excerpt');

    back into the functions.php file and got the same kind of error.

    visiblemedia

    (@visiblemedia)

    hm… well that didn’t work, my exerpts ended up looking like this:

    Last Chance for Freebie Play
    February 28, 2009 | By RotoRob | Comments (0)

    Warning: rtrim() [function.rtrim]: Invalid ‘..’-range, no character to the left of ‘..’. in /nfs/c04/h01/mnt/60416/domains/rotorob.com/html/wp-content/themes/RotoRob_v7/functions.php on line 32

    Warning: rtrim() [function.rtrim]: Invalid ‘..’-range, no character to the right of ‘..’. in /nfs/c04/h01/mnt/60416/domains/rotorob.com/html/wp-content/themes/RotoRob_v7/functions.php on line 32
    If you don’t want your kid to wind up like this, teach him how to play fantasy sports properly. In the past couple of weeks, we’ve brought you articles designed to help you with your strategy when playing hockey or basketball fantasy leagues on Draftbug. Well, today (i.e., February 28) is your last chance to take advantage […] more

    I wonder if the stuff in the template is conflicting with the stuff in the functions.php?

    I have this in my template:

    <?php $count++; ?>
    <?php if ($count < 2) : ?>
    <?php the_content() ?>
    <?php else : ?>
    <?php remove_filter('the_excerpt', 'wpautop'); ?>
    <?php the_excerpt();?>
    <a href="<?php the_permalink() ?>">more</a>
    <?php endif; ?>

    where you would normaly find this:

    <?php the_content() ?>

    I do that so that I can display the first post in full, followed by 4 excerpts.

    maybe the:

    <?php remove_filter('the_excerpt', 'wpautop'); ?>
    <?php the_excerpt();?>

    in the template is conflicting with the

    function trim_excerpt($text) {
      return rtrim($text,'[...]');
    }
    add_filter('get_the_excerpt', 'trim_excerpt');

    in the functions.php?

    visiblemedia

    (@visiblemedia)

    hm… I tried that but my functions file doesn’t have that in it. so I added it verbatim like this:

    <?php
    function wp_new_excerpt($text)
    {
    if ($text == ”)
    {
    $text = get_the_content(”);
    $text = strip_shortcodes( $text );
    $text = apply_filters(‘the_content’, $text);
    $text = str_replace(‘]]>’, ‘]]>’, $text);
    $text = strip_tags($text);
    $text = nl2br($text);
    $excerpt_length = apply_filters(‘excerpt_length’, 55);
    $words = explode(‘ ‘, $text, $excerpt_length + 1);
    if (count($words) > $excerpt_length) {
    array_pop($words);
    array_push($words, ‘…’);
    $text = implode(‘ ‘, $words);
    }
    }
    return $text;
    }
    remove_filter(‘get_the_excerpt’, ‘wp_trim_excerpt’);
    add_filter(‘get_the_excerpt’, ‘wp_new_excerpt’);
    ?>

    I just changed

    array_push($words, ‘[…]’);

    to

    array_push($words, ‘…’);

    and it kinda worked on the page, but something else in the above code interfered with publishing. I got an error having to do with functions.php and a header already being called or something like that.

    so I took it out. ??

    Is there a way to add JUST the array thing?

    I assume this

    <?php
    function wp_new_excerpt($text)
    array_push($words, ‘…’);
    ?>

    isn’t right, and I’m afraid to try it.

    visiblemedia

    (@visiblemedia)

    ok, if anyone here is interested in the <p></p> solution, i found it:

    <?php remove_filter(‘the_excerpt’, ‘wpautop’); ?>

    that gets rid of the <p></p> now if i can only get rid of the […]

    ??

    visiblemedia

    (@visiblemedia)

    I’m having this issue too, I’d like to remove the <p> that comes after that too so that the read more link immediately follows the excerpt without dropping down a line.

    Thread Starter visiblemedia

    (@visiblemedia)

    AWESOME! that worked thanks.

    Forum: Fixing WordPress
    In reply to: Image upload fail

    here’s a wrinkle… i did that but this is what i found:

    upload_tmp_dir no value no value

    any idea how to overcome this?

    Hey, i notice the searching with quotes now seems to work on https://mybabymonsters.com/stories have you found a solution?

    Forum: Fixing WordPress
    In reply to: archives forbidden
    Thread Starter visiblemedia

    (@visiblemedia)

    YES! woohooo! that worked thanks!

    Forum: Fixing WordPress
    In reply to: archives forbidden
    Thread Starter visiblemedia

    (@visiblemedia)

    hm, ok, that would explain why the months that DO work are not in folders … i guess thats all in the DB… So, any ideas why November and December are not working?

    here’s the site address:
    https://www.rotorob.com/

    check out November and December in the archives section. they generate errors, but the other months work fine.

    Actualy i just had an idea… i imported the posts and archives from blogger. it got most of the way through importing and them stalled at this point

    Files published… 35%

    (and showed an error on the bottm of the browser

    so i refreshed the page and it told me it was all finished successfuly.

    i tried it again just now on a different blog (just a test blog on a subdomain) and the same thing happend.

    Here’s the error details:
    Line: 1
    Char: 1
    Error Not implemented
    Code: 0
    URL: https://basketball.rotorob.com/wpadmin/admin.php? import=blogger&noheader=true&blog=30345455

    i refreshed the page (cause it was stuck at 35%)
    and it reloaded listing the blog as 90% imported.

    i clicked the 90% and it reloaded congratulating me on successfuly importing blogger into WP.

    but this time all archive links DO work… should i reimport it from blogger? will that duplicate posts? will importing overwrite posts ive made since importing the first time?

    (sorry for the long post)

Viewing 15 replies - 1 through 15 (of 18 total)