Vladut
Vladut

Reputation: 657

How replace a character with another character in css?

i want to display with help css a character with another character. In my page wordpress i have a code like this:

</span>
                <span class="address-place">
                 <?php echo the_excerpt (); ?>
                 <hr>
            </span>

This code display this line:

< p >Adult Care Home in SE Portland hiring a live-in caregiver; must speak English, be able to perform the job duties…

I want to replace < p > with another character like nothing or something else in css? I don't need to display that character in my description and i want to hide him but in css because my edit page generate < p > tags.

Display image in site: enter image description here

Thanks

Upvotes: 3

Views: 2142

Answers (2)

Jevuska
Jevuska

Reputation: 480

Function the_excerpt() was echo in return, so don't use echo ( recommended to used in wp loop ). If you need to use echo, use function get_the_excerpt().

If you have issue html not decode properly, use wp_specialchars_decode. Here the options that you can achieve:

Filter the_excerpt, put this code into functions.php

    add_filter( 'the_excerpt', 'wpse221201_get_the_excerpt', 1, 1 );
    function wpse221201_get_the_excerpt( $content )
    {
        if ( ! is_admin() )
            return wp_specialchars_decode( $content );

         return $content;
    }

Or direct decode into function

echo wp_specialchars_decode( get_the_excerpt() );

Upvotes: 1

VoteyDisciple
VoteyDisciple

Reputation: 37813

CSS cannot manipulate text; it's purely a language for styling your content.

But you're using PHP — just have the PHP output whatever you wanted in the first place.

<?php echo str_replace('p>', 'whatever>', get_the_excerpt()); ?>

Upvotes: 4

Related Questions