The MU forums have moved to WordPress.org

amazing grace theme on wpmu (6 posts)

  1. Ovidiu
    Member
    Posted 13 years ago #

    said theme, shows a random header from the image folder, the code used is the following:

    <style type="text/css">
      #portrait-bg { background:url(<?php bloginfo('stylesheet_directory'); ?>/images/bg-portrait<?php echo (rand()%9); ?>.jpg); }
    </style>

    I'd like to modify the theme so it picks a random image from a folder where the user can upload images. there must be a variable pointing to the current logged blog's admin folder so he can upload pictures there that will then appear randomly.

    any ideas how such a path could look like and what other modifications would need to be done?

  2. andrea_r
    Moderator
    Posted 13 years ago #

    There's a random image plugin I used lately that let you specify the folder. I bet you could modify it to hardcode the folder name, plunk that in there and presto - bob's yer uncle.

  3. Ovidiu
    Member
    Posted 13 years ago #

    yeah, sounds good, but that should also be doable with built in wpmu functionality, right? isn't there a variable for blog_id? that should do the trick...

  4. andrea_r
    Moderator
    Posted 13 years ago #

    bloginfo gets their blog's location. BUT then it looks for the theme folder.

    You need extra code to find a different folder in their user files, or a common one to everyone. And then let them upload to that.

  5. Computer-Tipps
    Member
    Posted 13 years ago #

    ... does it work?
    I think there might be a problem with the rights for the folder

  6. Ovidiu
    Member
    Posted 13 years ago #

    no I haven't gotten around to do this and it is way over my head, but I still am sure its doable but I am not up to the challenge, have another look at what I propose:

    original:

    <style type="text/css">
      #portrait-bg { background:url(<?php bloginfo('stylesheet_directory'); ?>/images/bg-portrait<?php echo (rand()%9); ?>.jpg); }
    </style>

    my idea:

    <style type="text/css">
      #portrait-bg { background:url(<?php bloginfo('current_blog_url'); ?>/CURRENT_BLOG_ID/images/bg-portrait<?php echo (rand()%9); ?>.jpg); }
    </style>

    what is wrong with this? should work in my opinion...

About this Topic