WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] image path in general-template.php (4 posts)

  1. nevilletietz
    Member
    Posted 3 years ago #

    My php syntax is not the greatest and I need to change the "submit" button to a type=image. What is the correct path name for the image src using the equivalent of <?php bloginfo('template_directory'); ?> ?

    <input type="image" id="searchsubmit" value="'. esc_attr__('Search') .'" src="??????????/images/go.gif" border="0"/>

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Try <input type="image" id="searchsubmit" value="'. esc_attr__('Search') .'" src="<?php get_bloginfo('template_directory'); ?>/images/go.gif" />

  3. nevilletietz
    Member
    Posted 3 years ago #

    I originally tried that but it's not working as the input code lies within a function:

    function get_search_form($echo = true) {
    do_action( 'get_search_form' );

    $search_form_template = locate_template(array('searchform.php'));
    if ( '' != $search_form_template ) {
    require($search_form_template);
    return;
    }

    $form = '<form role="search" method="get" id="form1" action="' . home_url( '/' ) . '" >
    <div>
    <input type="text" value="' . get_search_query() . '" name="s" id="s" />
    <input type="image" id="searchsubmit" value="'. esc_attr__('Search') .'" src=" <?php bloginfo('template_directory'); ?>/images/blank.gif" border="0"/>
    </div>
    </form>';

    if ( $echo )
    echo apply_filters('get_search_form', $form);
    else
    return apply_filters('get_search_form', $form);
    }

  4. nevilletietz
    Member
    Posted 3 years ago #

    I worked it out finally:

    <input type="image" id="searchsubmit" value="'. esc_attr__('Search') .'" src="'. get_bloginfo('template_directory') .'/images/blank.gif" border="0"/>

Topic Closed

This topic has been closed to new replies.

About this Topic