Site logo

Archived topic

Can not display Code

10 replies · Started by Marius on May 10, 2020

Viewing posts 1–11 of 11

Henlo,

I write an article, where i want to explain how to implement Braedcrumbs Navigation with Yoast Seo.

I write the php code in the code tags like so

<code><?php if ( function_exists('yoast_breadcrumb') && is_single() ) : ?>
    <div class="grid-container yoast-breadcrumb">
        <?php yoast_breadcrumb( '<p id="breadcrumbs">','</p>' ); ?>
    </div>
<?php endif; ?></code>

But when I click on preview page i get this result:

','
' ); ?>

I use the Marketer Site, just to let you know

I don´t want to use a plugin just to show some code on my page. I thought that tht code tags are there to use. But they don´t work.

How can I make them work?

Try to insert code using < pre > .... </ pre > tag rather than using < code>

Hi there,

are you using the Block editor?
If so add the code directly to a Code Block.

That does not work. With the pre tag it gives me this:

','' ); ?>

No I am using classic text editor.

Is there eventually some css missing for displayin code?

Thanks David,

I thought that the code tags in text editor are for such things. I will look into your suggestion.

Yeah most codes are fine - eg. HTML / CSS / JS to be output in a code block.
PHP is a server side language and WP will strip it for security reasons.

This archived topic is closed to new replies.