• Resolved wp_saint

    (@jimmythesaint)


    For my client sites i have a little developer plugin i have created, giving clients contact details etc, and cleaning up a few other WordPress things…. with this i’m trying to add a button to the WP Admin bar for clients to raise support requests, and struggling to add the `bloginfo(name)’ to the email subject field (highlighted in bold below)…. how do i concatenate the string to allow for the site name to be completed dynamically?

    $wp_admin_bar->add_menu( array(
            'id' => 'support-request',                // an unique id (required)
            'parent' => 'custom-support-menu',           // false for a top level menu
            'title' => 'Raise Support Request',     // title/menu text to display
            'href' => 'mailto:[email protected]?subject=<strong>Client%20Site</strong>%20Support%20Request',
            'meta' => array( 'target'=>'_blank' ),  // target for link
        ) );

    Advice and explanation very much appreciated

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Use get_bloginfo('name') to get a returned value usable in concatenation.
    'href' => 'mailto:[email protected]?subject='.get_bloginfo('name').'%20Support%20Request',

    Thread Starter wp_saint

    (@jimmythesaint)

    Many thanks!

    I knew i was somewhere on the right track, but got all in a muddle!

    Completed task with the following:

    $wp_admin_bar->add_menu( array(
            'id' => 'support-request',
            'parent' => 'custom-support-menu',
            'title' => 'Raise Support Request',
            'href' => 'mailto:[email protected]?subject=Client%20Website%20-%20 '. get_bloginfo(name) .' %20-%20Support%20Request',
            'meta' => array( 'target'=>'_blank' )
        ) );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how do i concatenate the string to allow for the site name to be completed dynam’ is closed to new replies.