logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$10
custom excerpt

when self-generating the excerpt, you see the "alt " for images.
How I can exclude them? and how can I prevent an automatically apply of the <p>?



I use this code to show an archive on http://fdmed.org/category/noticias/
<div style="float:left;margin-bottom:10px;width:100%"><div class="thumblist"><?php if ( has_post_thumbnail()) : ?><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" ><?php the_post_thumbnail('thumbnail'); ?> </a> <?php endif; ?></div><div style=""><h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> (<?php the_time('d M y') ?>)</h1><span class="linetwo"><?php the_excerpt (); ?></span></div></div>

This question has been answered.

Albert Ariza | 05/11/11 at 6:56am Edit


(4) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    05/11/11
    7:00am
    Rashad Aliyev says:

    Hello,

    You should look at your functions.php for changing it.

  • avatar
    Last edited:
    05/11/11
    7:07am
    Sébastien | French WordpressDesigner says:

    you don't want the "alt" and you don't want the <p> that's it ?

    • 05/11/11 7:14am

      Albert Ariza says:

      yes

    • 05/11/11 7:15am

      Albert Ariza says:

      please

    • 05/11/11 7:48am

      Sébastien | French WordpressDesigner says:

      the "alt" will be empty if you use this code

      <div style="float:left;margin-bottom:10px;width:100%"><div class="thumblist"><?php if ( has_post_thumbnail()) : ?><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" ><?php the_post_thumbnail('thumbnail', array('alt'=>'')); ?> </a> <?php endif; ?></div><div style=""><h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> (<?php the_time('d M y') ?>)</h1><span class="linetwo"><?php the_excerpt (); ?></span></div></div>

    • 05/11/11 7:54am

      Sébastien | French WordpressDesigner says:

      if you want absolutely not "alt" you can use this code

      <?php
      $url_img = get_the_post_thumbnail( $post->ID,'thumbnail', array('alt'=>'') );
      $url_img = str_replace ('alt=""','',$url_img)
      ?>

      <div style="float:left;margin-bottom:10px;width:100%"><div class="thumblist"><?php if ( has_post_thumbnail()) : ?><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" ><?php echo $url_img; ?> </a> <?php endif; ?></div><div style=""><h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> (<?php the_time('d M y') ?>)</h1><span class="linetwo"><?php the_excerpt (); ?></span></div></div>

    • 05/11/11 7:55am

      Sébastien | French WordpressDesigner says:

      @ denzel > there is no image in an excerpt... is it ?

    • 05/11/11 7:58am

      Sébastien | French WordpressDesigner says:

      and no <p> in theory...

    • 05/11/11 8:02am

      Sébastien | French WordpressDesigner says:

      if the <p> is apply in your excerpt it's probably because there is a function to do that in your function.php
      In wordpress, <p> is not apply in the excerpt.

      Find "the_excerpt" in your file functions.php and paste the code here please

    • 05/11/11 8:06am

      Sébastien | French WordpressDesigner says:

      @Denzel : ^^

  • avatar
    Last edited:
    05/11/11
    7:08am
    Vidyut Kale says:

    Hi,

    I didn't understand the problem accurately. Can you share the code that you want outputted differently?

    Vidyut

  • avatar
    Last edited:
    05/11/11
    7:52am
    Denzel Chia says:

    Hi,

    Please try the below codes.
    I had added my codes to what you posted.


    <?php the_time('d M y') ?>)</h1><span class="linetwo">
    <?php
    $excerpt = get_the_excerpt();
    $find = array("<p>","</p>","alt=''");
    $excerpt = str_replace($find," ",$excerpt);
    echo $excerpt;
    ?>
    </span></div></div>


    Thanks.
    Denzel

    • 05/11/11 8:00am

      Denzel Chia says:

      Yes, Sebastien, you are correct. There is no alt in excerpt. I did not see the question properly.
      But make sure you don't copy anything I posted.
      And there is no need for you to self promote by pointing out my mistake.

      Thanks.

    • 05/11/11 8:08am

      Denzel Chia says:

      Mr Sebastien,

      Please just mind your own business.
      People have freedom to post what they think is correct,
      it is for the asker to judge, and not by you.
      I am sure you will not like me to comment on your answer right?
      Oh, by the way you forget a colon in your code. I am sure it will cause a PHP syntax error.

      Thanks.

This question has expired.



Albert Ariza voted on this question.



Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.