WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] image path in general-template.php

[Resolved] image path in general-template.php

  • 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″/>

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    @esmi

    Forum Moderator

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

    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);
    }

    I worked it out finally:

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] image path in general-template.php’ is closed to new replies.
Skip to toolbar