Community Forums › Forums › Archived Forums › Design Tips and Tricks › Modify Credits URL for Dynamic Display
- This topic has 8 replies, 3 voices, and was last updated 7 years, 11 months ago by
Brad Dalton.
-
AuthorPosts
-
February 13, 2017 at 2:37 pm #201074
bamajr
ParticipantFull disclosure...
I'm modifying a script found at: http://my.studiopress.com/documentation/snippets/footer/customize-the-credits-text/
//* Change the footer text add_filter('genesis_footer_creds_text', 'sp_footer_creds_filter'); function sp_footer_creds_filter( $creds ) { $creds = 'Copyright [footer_copyright] · <a href="SITE-URL">SITE-NAME</a> · All Rights Reserved · [footer_loginout]'; return $creds; }
This script works great in a stand-alone WordPress installation, but what if the theme is being used on multiple sites, within a multi-site network? I'd like to be able to call the SITE-URL in the "href=" area and call the SITE-NAME in the "My Custom Link" area, so the SITE-URL and SITE-NAME change automatically, when a new site is added to the multi-site network.
The Genesis filter reference doesn't seem to mention anything about an ability to add SITE-URL or SITE-NAME to the genesis_footer_creds_text. Any thoughts?
https://itsallundercontrol.com/February 13, 2017 at 2:53 pm #201075Brad Dalton
ParticipantFebruary 13, 2017 at 3:16 pm #201078Victor Font
ModeratorCreate shortcodes to retrieve the site name and url, then use them in your snippet. SITE-URL and SITE-NAME are not PHP contants unless you define them as such in your theme. If they were defined, they wouldn't be SITE-URL and SITE-NAME anyway. They would be SITE_URL and SITE_NAME. The way multisite works, you would either have include the shortcodes in every theme on the site or use a multisite compatible snippet plugin like WP Clips that would auto-load the shortcodes on every site. You can try this to see if it gets started. The shortcodes woul be [display_site_url] and [display_site_name]
add_shortcode( 'display_site_url', 'ms_display_site_url' ); function ms_display_site_url() { echo site_url(); } add_shortcode( 'display_site_name', 'ms_display_site_name' ); function ms_display_site_name() { bloginfo( 'name' ); }
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 14, 2017 at 2:39 pm #201177bamajr
ParticipantThank you for chiming in @braddalton - always a pleasure.
Yes, I do know how to modify the script to display a specific Site-Name, on all sites within the multi-site network. However, I'm not able to make it dynamically change, with each new website on the multi-site network.
February 14, 2017 at 2:39 pm #201178bamajr
ParticipantThank you @VictorFont. I think that will work!
February 14, 2017 at 2:55 pm #201180bamajr
Participant@VictorFont This didn't work as expected, but I am much closer.
I have modified the script as follows:
add_shortcode( 'display_site_url', 'ms_display_site_url' ); function ms_display_site_url() { echo site_url(); } add_shortcode( 'display_site_name', 'ms_display_site_name' ); function ms_display_site_name() { bloginfo( 'name' ); } //* Change the footer text add_filter('genesis_footer_creds_text', 'sp_footer_creds_filter'); function sp_footer_creds_filter( $creds ) { $creds = 'Copyright [footer_copyright] · <a href="[display_site_url]">[display_site_name]</a> · All Rights Reserved · [footer_loginout]'; return $creds; }
...and it returns this:
HTTPS://TEST.CARETOPLAN.NET/7F011FF0-510D-450D-9BD1-2CD5D89A88E9ALZHEIMER'S SPEAKS (CTP) COPYRIGHT © 2017 · · ALL RIGHTS RESERVED · MY WEB MGMT CO. · LOG OUT
I figure I'm not escaping something correctly but trying to modify this has resulted in WordPress' beloved WSoD 😉
February 15, 2017 at 4:11 am #201202Brad Dalton
ParticipantFebruary 23, 2017 at 10:32 am #201823bamajr
ParticipantThank you Mr. Dalton.
I actually searched your website for a solution to this but never found the solution you linked.
February 23, 2017 at 12:19 pm #201830Brad Dalton
Participant -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.