-1

I am trying to develop a Wordpress Plugin (to develop my skills) that allows a user to customise their Wordpress login page.

I have a settings page where the user can choose to replace the Wordpress logo. However, I cannot call this option correctly from the database. I have read about string concatenation and nesting php tags but I cannot get this function to work.

<?php

$bglogo = get_option('background_logo');

function custom_login_logo() {
    echo '<style type="text/css">
        h1 a { background-image: url(.$bglogo.)  !important; }
          </style>';
}
?>

I have tried the below without success:

background-image: url(".$bglogo.")  !important;

background-image: url('.$bglogo.')  !important;

Is it possible the problem is the style tags?

Trevor J
  • 11
  • 1
  • 5

1 Answers1

1

EDIT - Made a mistake in previous answer.

Current code:-

function custom_login_logo() {
    $bglogo = get_option('background_logo'); ?>
    <style>
        h1 a{
            background-image: url(<?php echo $bglogo; ?>)!important;
        }
    </style>
    <?php
}
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
John Halsey
  • 1,930
  • 3
  • 19
  • 41