Add site name to the footer content

Hi there,

I would like to display the site name in the footer content of potential subsites.
I am trying to use the code <?php echo bloginfo( ‘name’ ); ?> to display the site name but it is returning nothing. If I view the source code being produced it displays the above code in red.

Am I missing something or does this not work? :disappointed:

Thanks

  • Predrag Dubajic
    • Support

    Hey Mike,

    Hope you're doing well today :slight_smile:

    I see that you have selected Ultimate Branding for this thread, does that mean that you're using UB footer content module to add this code?
    If yes, I'm afraid that can't be done this way because PHP code can't be added to text editor.

    There's also one more thing I noticed, there are two type of single quotes and the ones you are using seem incorrect so it also could be related to that.
    Try using this instead:
    <?php echo bloginfo( 'name' ); ?>

    Best regards,
    Predrag

  • Baldafrican
    • Made in Africa

    Thanks for the reply.
    Could you offer any other solution to have the desired output in the global footer?

    I would like to display the sitename along with my brand on each site (most likely in the footer). I thought the UB footer would be the best solution but seems I was wrong :slight_frown:

  • Predrag Dubajic
    • Support

    Hi Mike,

    I was looking a bit more into this and having a possibility to use shortcodes in that field would be a good solution for your case.

    So I'll create feature request to enable use of shortcodes and in the meantime you can apply this workaround.

    First thing we need to do is modify Ultimate Branding files a bit so it renders shortcodes properly, you can do that by downloading first attached file (global-footer-content.php.zip), unzip it and place it inside /wp-content/plugins/ultimate-branding/ultimate-branding-files/modules/ and overwrite the existing file.

    Once that's done we now need custom shortcode that will render current blog name, I've created mu-plugin for you so you would need to download second attached file (shortcode_site_name.php.zip) and place it inside your /wp-content/mu-plugins/ folder, if you don't have that folder simply create it yourself.

    Once the file is there you will be able to use below shortcode to show blog name in any content, including UB footer content field.
    This is the shortcode to use:
    [return_blog_name]

    Hope this helps :slight_smile:

    Best regards,
    Predrag

  • Baldafrican
    • Made in Africa

    Hi Predrag Dubajic ,

    Thanks for taking the time to sort this issue. Very appreciative of it being setup as a features request, hopefully we'll see it happen in the future.

    I have placed the files in the relevant folders but it does not seem to display the site name :slight_frown:
    Perhaps it would be easier for you to advise if you took a look. I have granted support access.

    Let me know if you require anything.

    Thanks so much!

  • Predrag Dubajic
    • Support

    Hi Mike,

    Since it's quite easy fix I already asked developer to include it in plugin so it will be added in next release :wink:

    As for it not working on your site, I see that you still had PHP code instead of shortcode inside your footer content for subsites so after changing that to shortcode it started working.

    Best regards,
    Predrag

  • Baldafrican
    • Made in Africa

    Hi Predrag Dubajic ,

    Thanks so much! I thought it would only need the initial change on the main site section ...silly me.

    Is it possible to have them displayed on the same line like I was hoping before rather then the shortcode breaking into a new line for the rest of the words so it would look like
    sitename | the rest of the slogan

    rather than

    sitename
    | the rest of the slogan

  • Adam Czajczyk
    • Support Gorilla

    Hello Mike!

    I accessed your site and made small change to your footer HTML:

    - I removed doubled "container" div as you only need a single one (no need for nesting here)
    - I added an additional class name to that div

    This doesn't center the footer but will let you add a CSS rule that will. Please create an empty file with a .php extension (e.g. "footer-custom-css.php") and put this code inside:

    <?php
    // Add items to the header!
    function wpmu_global_css() {
    	echo "<style>
              .custom-footer_info p {
    			  text-align:center;
    		  }
             </style>";
    }
    add_filter('wp_head', 'wpmu_global_css');

    Then upload the file to the "/wp-content/mu-plugins" of your site (just like you did with files that my colleague Predrag shared with you) and that should do the trick.

    Best regards,
    Adam

  • Dimitris
    • Support Star

    Hey there Mike,

    hope you're doing good and don't mind chiming in! :slight_smile:

    Looking at the outputted code, I think I can see where the issue may lie

    <div class="\"container" custom-footer_info\"="">

    Any idea how to fix this?

    I was able to replicate this in my end. Could you please access your server via FTP and make couple of small changes in /wp-content/plugins/ultimate-branding/ultimate-branding-files/modules/global-footer-content.php file?
    Lines #93 and 105 should be like
    <?php echo apply_filters( 'the_content', $global_footer_content );?>
    replace them with
    <?php echo apply_filters( 'the_content', stripslashes($global_footer_content ));?>

    Warm regards,
    Dimitris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.