WordPress.org

Ready to get started?Download WordPress

Forums

HTML stripped on home page - want it active (9 posts)

  1. DigitalPresences
    Member
    Posted 4 years ago #

    Been struggling with this one for a few days now and I think it's time to bring it to the pros!

    My site: http://hdhpexpert.com

    What I want to do: Leave all post HMTL's un-stripped when posts appear on the homepage.

    My Theme: Tutorialicious

    I have tried numerous plugins (listed below) thinking that this would be the easiest solution, but with no luck. I have also tried to edit my code but my knowledge on this is limited at best and I do not want to make anything worse.

    My guess is that there is something with my theme's code that is preventing plugin's from allowing the html of posts on my homepage. My code does have an 'excerpt.php' file that clearly has a lot to do with my issues, but have not been able to successfully edit it on my own to solve the issue. Here is my excerpt.php code:

    <div class="excerpt_post">
        <div class="excerpt_in">
        <?php include(TEMPLATEPATH."/thumbnail.php"); ?>
            <div class="the_NULL">
                <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <div class="excerpt_left">
                    <?php the_time('F jS, Y') ?> by <?php the_author() ?>&nbsp;<?php edit_post_link('Edit','',''); ?>
                </div>
    
                <?php content_limit(400); ?>
            </div>
            <div class="clear"></div>
            <div class="excerpt_data">
    
                <div class="excerpt_right">
                    <div class="excerpt_but">
                        <?php comments_popup_link('Comment', '1 Comment', '% Comments'); ?>
                    </div>
    
                </div>
            <div class="clear"></div>
            </div>
        </div>
    </div>

    An important piece of info: Don't want to unnecessarily complicate this but this may be important - my theme originally installed with 'excerpt' spelled incorrectly as 'excrept' across the entire theme. I corrected this but in doing so I may have created other consequences.

    Plugins that have not solved my problem:
    Custom Excerpts
    Advanced Excerpt
    Excerpt Editor
    Evermore

    ANY AND ALL THOUGHTS/IDEAS/SUGGESTIONS ARE APPRECIATED! I am sick of my homepage posts looking smashed and plain.

  2. vtxyzzy
    Member
    Posted 4 years ago #

    The Raw HTML plugin might do what you want.

  3. DigitalPresences
    Member
    Posted 4 years ago #

    I am giving that a shot as we speak - thank you for taking the time to read my post vtxyzzy.

  4. DigitalPresences
    Member
    Posted 4 years ago #

    No luck with that plugin.

    I'm thinking this has to be related to my theme; for whatever reason it is not written in a way that allows pairing with a excerpt-controlling plugin.

    For those with more knowledge than myself, is this something I can fix via only the excerpt.php code or are other theme files going to need to be altered as well?

  5. alchymyth
    Forum Moderator
    Posted 4 years ago #

    see if you can locate the function content_limit():
    <?php content_limit(400); ?>
    which seems to generate your content.

    and maybe post it here?

  6. DigitalPresences
    Member
    Posted 4 years ago #

    from my excerpt.php file, starting with the line of code you asked for:

    <?php content_limit(400); ?>
            </div>
            <div class="clear"></div>
            <div class="excerpt_data">
    
                <div class="excerpt_right">
                    <div class="excerpt_but">
                        <?php comments_popup_link('Comment', '1 Comment', '% Comments'); ?>
                    </div>
    
                </div>
            <div class="clear"></div>
            </div>
        </div>
    </div>

    Toying with the '400' number makes my excerpts longer but the html is still stripped. No links, no font formatting, all text smushed together etc. I have tried changing the word 'excerpt_data' to 'content_data' and this has made no visible changes.

    I'm sure a fix isn't far off, but at the same time me playing around with the code and trying any number of permutations is like likely to result in a positive result.

    Any and all help appreciated thank you.

  7. alchymyth
    Forum Moderator
    Posted 4 years ago #

    thanks. i found the function in functions.php, and it contains:

    $content = strip_tags($content);

    which removes all html tags from the shortened content.
    there is no workaround for it, as it would otherwise result in invalid code and could lead to browser problems.

    you could try and replace <?php content_limit(400); ?> in your posted code with <?php the_content('...'); ?> and put a more tag into all your articles at the right position.
    and see if/how this works with the theme.

  8. DigitalPresences
    Member
    Posted 4 years ago #

    Wow alchymyth I cannot thank you enough. With your advice here's what I've done to keep the html from being stripped from my posts:

    I removed $content = strip_tags($content); entirely from my template.php file, as an experiment. To my surprise my pages load just fine without it and the html is not stripped! I haven't clicked through my whole site but so far so good.

    Further helping my problem, I changed the number in <?php content_limit(400); to a value of 2000, which essentially means that I am now in total control of any "Read More" links should they be needed.

    Now all of my html shows on my homepage: images, links, formatting etc.

    Thank you for taking the time to look at my site and digging through my php files. I didn't even post my template.php code so it says a lot that you were willing to go the extra mile in helping me with my question.

    To show my gratitude and if you're interested, I would be glad to exchange a reciprocal link with you between our sites.

  9. DigitalPresences
    Member
    Posted 4 years ago #

    Re-reading this and i want to clarify for those looking for this solution for their own theme:

    I removed $content = strip_tags($content); entirely from my FUNCTIONS.php file, not template.php.

    I changed the number in <?php content_limit(400); to a value of 2000, which essentially means that I am now in total control of any "Read More" links should they be needed. This code was edited within my excerpt.php file.

Topic Closed

This topic has been closed to new replies.

About this Topic