How can I Create a shortcode for "Site Tittle"?

Hi there heroes!

In our WPMU, users can create new Blogs. When they create a new Blog there's a page created automatically for their own Privacy Policy already written.

I'd like to place a shortcode for "My-Site" so each Blog can have this text replaced by their own name (Blog Tittle).

Maybe you could provide me some lights on how to achieve this. Thank's! :beer:

  • Nastia
    • Support Rock Star

    Hello Urbano , I hope all is well!

    This will require custom coding. And it also depends on what plugin are you sing to add a Privacy Policy page. You will need to create a mu-plugin.

    I am not a PHP expert, though I've found few functions that will help you started:
    - With the $get_bloginfo, you can get the name of the subsite. So the bellow code should show the Name of the current blog.

        $blog_title = get_bloginfo();
         echo 'Blog '.$blog_title;

    - Then you will need to create ashortcode. The bellow links should help:

    But this code should work too:

    // Function to add shortcode to pages
    function create_blog_name_shortcode() {
        return $blog_title;
    add_shortcode('blogname', 'reate_blog_name_shortcode');

    So with the above code, you can use [blogname] shortcode to view the blog name.

    If you are not familiar with PHP, please feel free to post a new job in Jobs & Pros section so a skillful developer can do this for you.

    I hope this helps!


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.