0

Some of my Persian blog posts are about programming and naturally I have to write different commands over and over again in the sentences. In order for the font to be distinct and the direction left to right, I've defined something like this in my css file:

.incode { 
    font-family: monospace; 
    display: inline-block; 
    background: #ececec; 
    direction: ltr; 
    text-align: left; 
    padding: 0px 7px 0px 7px; 
}

And then I use it in the classic editor and in my sentences as:

<span class="incode">code goes here</span>

But it is long and it slows down my writing speed. Is there a way to define a special character instead of writing the above line? I mean instead of the above line, I write something like ``code goes here'' (placing the inline code in double backticks) to have the same effect?

1 Answer 1

3

If you're using a modern version of WordPress, with the Block Editor, you can add your code in a Code block and then ensure you're styling the Code blocks:

.wp-block-code code {
    font-family: monospace; 
    display: inline-block; 
    background: #ececec; 
    direction: ltr; 
    text-align: left; 
    padding: 0px 7px 0px 7px; 
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.