Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Excerpts, Read more, Pagination (http://forum.bytesforall.com/forumdisplay.php?f=20)
-   -   [SOLVED] Conditional Excerpt Strip (http://forum.bytesforall.com/showthread.php?t=13569)

SupraTT Mar 30, 2011 04:07 PM

[SOLVED] Conditional Excerpt Strip
 
I would like the post excerpts to not strip html tags for a specific page. I tried inputting the following in Configure EXCERPTS > "Don't strip these tags"

<?php if (! is_home() ) {?><iframe><span><p><?php } ?>

but it seems Atahualpa ignores the php conditional test.

Using this so that I can use the full image size or embedded video for the excerpt in all pages except for the home page. The home page is using featured image thumbnails that are a certain size.

lmilesw Mar 30, 2011 09:51 PM

I am trying to understand what you want. Is the following correct?
  • You want to strip tags on home page
  • You dont' want to strip the iframe span and p tags on all but the home page

SupraTT Mar 30, 2011 10:07 PM

Quote:

Originally Posted by lmilesw (Post 62050)
I am trying to understand what you want. Is the following correct?
  • You want to strip tags on home page
  • You dont' want to strip the iframe span and p tags on all but the home page

Hi Larry,

Yes, this is exactly what I want to do.

Thank you,

SupraTT

juggledad Mar 31, 2011 05:05 AM

That is not an area that php is evaluated in.

SupraTT Mar 31, 2011 09:47 AM

Quote:

Originally Posted by juggledad (Post 62075)
That is not an area that php is evaluated in.

Hi Juggledad,

Do you know where I can make the necessary modifications? I looked in functions.php:

Code:

function bfa_wp_trim_excerpt($text)
Code:

// Build the excerpt from the post
                $text = apply_filters('the_content', $text);
                $text = str_replace(']]>', ']]>', $text);
                $text = strip_tags($text, $bfa_ata['dont_strip_excerpts']);

I don't understand the $bfa_ata['dont_strip_excerpts'] part; is $bfa_ata a function? variable? Is $bfa_ata['dont_strip_excerpts'] equivalent to '<p><iframe><span>' aka the html elements I placed in Atahualpa's dashboard's Don't Strip area?

Sorry my PHP knowledge is basic.

juggledad Mar 31, 2011 11:36 AM

you could try this, change the line
HTML Code:

                $text = strip_tags($text, $bfa_ata['dont_strip_excerpts']);
to
HTML Code:

        if (!is_home()) {
                        $text = strip_tags($text, $bfa_ata['dont_strip_excerpts'].'<iframe><span><p>');
                } else {
                        $text = strip_tags($text, $bfa_ata['dont_strip_excerpts']);
                }

theoretically this will add the iframe, span and p when you are not on the home page.

SupraTT Apr 2, 2011 02:53 PM

Hi Juggledad,

Thank you for the coding help. That worked for me.

SupraTT


All times are GMT -6. The time now is 12:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.