How do I add text in a shortcode?

I think this might be an easier question but I can’t figure it out.

How can I add simple text inside a short code?

Read More

For example:

$return_string .= '<a href="'.get_permalink().'"><div>'.read more.'</div></a>';

So, I don’t just want to return text, but I want to return text and a link. I am using this shortcode to query the posts, but I want to add a “read more” link after each excerpt, but I cant figure out how to just add the text “read more.”

Any help would be appreciated!

Related posts

1 comment

  1. hello you can try this

    // Add Shortcode
    function text_shortcode( $atts , $content = null ) {
      // Code
      return '<div>' . $content . '</div>';
    }
    add_shortcode( 'b', 'text_shortcode' );
    

    The shortcode will be something like this

    [b] content [/b]
    

Comments are closed.