WordPress.org

Ready to get started?Download WordPress

Forums

need a WP_CONTENT_URL workaround (6 posts)

  1. wholmes
    Member
    Posted 2 years ago #

    WP_CONTENT_URL is set before mu-plugins are loaded, therefore things that use this constant, like, bloginfo('stylesheet_directory'), return the raw domain.

    Any ideas for a workaround?

    This is reposted from a 3 year old question btw.

  2. What are you actually trying to circumvent with an mu plugin?

  3. wholmes
    Member
    Posted 2 years ago #

    I'm trying to add an option to select a theme at signup. it works but the code uses this line to get the theme's thumbnail.

    <img style="margin-left:40px;display:block;" width="185" height="126" alt="" src="'.WP_CONTENT_URL.$theme['Template Dir']."/".$theme['Screenshot'].'" />

    outputs

    http://mydomain.com/wp-content/home/username/public_html/wp-content/themes/twenty-ten/screenshot.png

    But I need

    http://mydomain.com/wp-content/themes/twenty-ten/screenshot.png

    Thanks.

  4. wholmes
    Member
    Posted 2 years ago #

    Thanks that did help to segment the uri so I could build my link semi-dynamically.

    src="'.network_home_url()."/wp-content/themes/".$theme['Stylesheet']."/".$theme['Screenshot'].'"

    This get's the what I need from an array so each theme shows it's thumbnail. I'd like to eliminate the hard-coded part but this works for now.

    Thanks again

  5. There should be a function for that too...

    http://codex.wordpress.org/Function_Reference/get_template_directory grabs the 'current' theme directory, though, which isn't right. Try looking down that line, though.

Topic Closed

This topic has been closed to new replies.

About this Topic