Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm working on some themes for a multisite and would like to modify the code below. It relates to a special div that will display an image or logo that users upload.

Normally the logo links to the home page of the blog, but could it be modified so that if the user is logged in it will link to "/themes.php?page=wptuts-settings" instead which is the logo upload screen? Thanks

  <div class="art-headerobject"><div class="mylogo">
<?php $wptuts_options = get_option('theme_wptuts_options'); ?>   
        <?php if ( $wptuts_options['logo'] != '' ): ?>  
            <a href="<?php echo get_option('home'); ?>/"><div id="logo">  
                <img src="<?php echo $wptuts_options['logo']; ?>" />  
            </div>  
        <?php  endif; ?></div></a></div>
share|improve this question

1 Answer 1

up vote 0 down vote accepted

Change the line with the URL:

<a href="<?php echo get_option('home'); ?>/"><div id="logo"> 

… and check if the user is logged in:

<a href="<?php 
if ( is_user_logged_in() )
{
   echo admin_url( '/themes.php?page=wptuts-settings' );
}
else
{
    echo home_url( '/' );
}
?>/"><div id="logo"> 

And echo get_option('home'); is not correct.
See wp-includes/link-template.php:home_url() to understand why the real home URL is a little bit more complex.

share|improve this answer
    
Perfect - thank you very much for your help toscho –  speedypancake Oct 27 '12 at 12:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.